RIP Sprockets Asset Pipelines

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

RIP Sprockets Asset Pipelines

Dominic Son
Rails has always been about best practices in web development, not what's popular. If this were the case, why didn't rSpec make it as the default test suite in Rails 2? 

Unfortunately now, Rails 6 will contain bloat. But more concerning, leave most web developers vulnerable, as most will unknowingly install Node with sudo, making node_modules owned by root, allowing for some fun executions..

For a moment, Sprockets allowed us to align our Javascript with our MVC resources, it was maintainable, good design, that put Rails developers on the same page. But starting with Rails 6, we will divide - some into Angular, some into React, or Vue, or any of these other exotic front end frameworks that repeat yourself in generating HTML. 

I guess we never really cared about being efficient. It turns out all we cared about was job security.

- Dominic

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: RIP Sprockets Asset Pipelines

James Robey
Most frontend tooling has a build step now, the build step depends on
node/npm.   It's much cleaner to separate the javascript/css out from
sprockets and use webpacker instead.  For example, you'd need this for
css frameworks like tailwindcss that have a build step to generate
only the css you need.

I'd disagree that "most" developers are making the mistake of
installing node as root.  Even homebrew doesn't do that.

I agree there is tension due to the duplication of HTML generation on
server side vs front-end side.  It's unfortunate.  I'd love it if we
could have a full fledged SPA using only rails views/templates/logic.
Otherwise it's forcing us to relegate rails to just an API, and do SSR
in node instead.

On Wed, May 1, 2019 at 6:33 AM Dominic Son <[hidden email]> wrote:

>
> Rails has always been about best practices in web development, not what's popular. If this were the case, why didn't rSpec make it as the default test suite in Rails 2?
>
> Unfortunately now, Rails 6 will contain bloat. But more concerning, leave most web developers vulnerable, as most will unknowingly install Node with sudo, making node_modules owned by root, allowing for some fun executions..
>
> For a moment, Sprockets allowed us to align our Javascript with our MVC resources, it was maintainable, good design, that put Rails developers on the same page. But starting with Rails 6, we will divide - some into Angular, some into React, or Vue, or any of these other exotic front end frameworks that repeat yourself in generating HTML.
>
> I guess we never really cared about being efficient. It turns out all we cared about was job security.
>
> - Dominic
> https://linkedin.com/in/dominicson
> http://twitter.com/deezzer
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> Visit this group at https://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: RIP Sprockets Asset Pipelines

Jake Niemiec
Dominic, as a JS/webpack/node.js dev who has come to love Rails, don't judge webpack by webpackER. Rails devs from the JS/webpack side of things are just as unhappy with webpackER. (the bloat is real)

There is a reason why "procedurally generated javascript" is universally condemned. WebpackER uses YAML to generate a JS file that then compiles your project JS files. What could go wrong?
image.png
If you want to use accomplish simple tasks without playing whack-a-mole, I would check out https://github.com/nikushi/webpack_manifest which was inspired by https://inside.pixiv.blog/subal/4615. (in english)

If you want to see my reasons for speaking out against webpackER, you can look at an earlier email thread (https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/rubyonrails-talk/ST2Z8S85CFM) where I make the case that webpackER isn't bad, it just has taken on more than it can handle. 

Last year, DHH asked me to be part of the solution and I have been trying my best, but there are distinct pain points that core maintainers need to start listening to if they want webpackER to fill Sproket's shoes. I hope that we can all fix this.

PS: Try not to use homebrew for installing node, always try and use nvm (esp. for mac).

On Wed, May 1, 2019 at 7:43 AM James Robey <[hidden email]> wrote:
Most frontend tooling has a build step now, the build step depends on
node/npm.   It's much cleaner to separate the javascript/css out from
sprockets and use webpacker instead.  For example, you'd need this for
css frameworks like tailwindcss that have a build step to generate
only the css you need.

I'd disagree that "most" developers are making the mistake of
installing node as root.  Even homebrew doesn't do that.

I agree there is tension due to the duplication of HTML generation on
server side vs front-end side.  It's unfortunate.  I'd love it if we
could have a full fledged SPA using only rails views/templates/logic.
Otherwise it's forcing us to relegate rails to just an API, and do SSR
in node instead.

On Wed, May 1, 2019 at 6:33 AM Dominic Son <[hidden email]> wrote:
>
> Rails has always been about best practices in web development, not what's popular. If this were the case, why didn't rSpec make it as the default test suite in Rails 2?
>
> Unfortunately now, Rails 6 will contain bloat. But more concerning, leave most web developers vulnerable, as most will unknowingly install Node with sudo, making node_modules owned by root, allowing for some fun executions..
>
> For a moment, Sprockets allowed us to align our Javascript with our MVC resources, it was maintainable, good design, that put Rails developers on the same page. But starting with Rails 6, we will divide - some into Angular, some into React, or Vue, or any of these other exotic front end frameworks that repeat yourself in generating HTML.
>
> I guess we never really cared about being efficient. It turns out all we cared about was job security.
>
> - Dominic
> https://linkedin.com/in/dominicson
> http://twitter.com/deezzer
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> Visit this group at https://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.


--
WarmlyYours
Jake Niemiec
P: (800) 875-5285F: (800) 408-1100
Tell us how we're doing and receive $25 off your next order
 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: RIP Sprockets Asset Pipelines

johny ho
In reply to this post by James Robey
James,
 
I'd love it if we could have a full fledged SPA using only rails views/templates/logic.

You can! Best of all, without any APIs and with all the goodies of React. Here's a bit of self promotion:

It also works like Turbolinks for easy SPA functionality. While Turbolinks requests the next page’s HTML and does a <body> replacement, Breezy requests the next page’s props (written using jbuilder-like syntax) and does a replacement in your redux state. No APIs needed, since, like Turbolinks, just reuses your routes.

Here's a small visual of the end product

views/
  posts/
    index.js.props
    index.jsx
    show.js.props
    show.jsx

Breezy delegates the responsibility of markup to React and the responsibility of content (index.js.props) to Rails. 

You can do a lot of things like fragment deferment, fragment fetching, preload multiple pages in a single request, instaclick-ing. There also room for custom reducers when you need to do something more complicated.




On Wed, May 1, 2019 at 1:43 PM James Robey <[hidden email]> wrote:
Most frontend tooling has a build step now, the build step depends on
node/npm.   It's much cleaner to separate the javascript/css out from
sprockets and use webpacker instead.  For example, you'd need this for
css frameworks like tailwindcss that have a build step to generate
only the css you need.

I'd disagree that "most" developers are making the mistake of
installing node as root.  Even homebrew doesn't do that.

I agree there is tension due to the duplication of HTML generation on
server side vs front-end side.  It's unfortunate.  I'd love it if we
could have a full fledged SPA using only rails views/templates/logic.
Otherwise it's forcing us to relegate rails to just an API, and do SSR
in node instead.

On Wed, May 1, 2019 at 6:33 AM Dominic Son <[hidden email]> wrote:
>
> Rails has always been about best practices in web development, not what's popular. If this were the case, why didn't rSpec make it as the default test suite in Rails 2?
>
> Unfortunately now, Rails 6 will contain bloat. But more concerning, leave most web developers vulnerable, as most will unknowingly install Node with sudo, making node_modules owned by root, allowing for some fun executions..
>
> For a moment, Sprockets allowed us to align our Javascript with our MVC resources, it was maintainable, good design, that put Rails developers on the same page. But starting with Rails 6, we will divide - some into Angular, some into React, or Vue, or any of these other exotic front end frameworks that repeat yourself in generating HTML.
>
> I guess we never really cared about being efficient. It turns out all we cared about was job security.
>
> - Dominic
> https://linkedin.com/in/dominicson
> http://twitter.com/deezzer
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> Visit this group at https://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.