4 ms·
re: asset pipeline It's beyond me why rails thinks it should dictate how to write/manage/package javascript. As a newbie-ish javascript developer I am continu
by apsurd 15y ago
re: asset pipeline
It's beyond me why rails thinks it should dictate how to write/manage/package javascript.
As a newbie-ish javascript developer I am continually learning from great projects like requirejs, enderjs, nodejs, commonjs (AMD in general), backbonejs, etc.
How arrogant do rails programmers have to be to dip their hand into javascript best practices? Honest question, because the better I get at programming the more I feel like rails is less necessary.
- Fluxx 15y agoThey're not dictating how you use JS, best practices, or anything like that, it's simply a pipeline for compressing and delivering assets. You also don't have to use it if you don't want to. There is a "config.assets.enabled" option in application.rb that you can set to "false" to turn it off. Bottom line is Rails is, and always has been, and opinionated framework, which you choose to buy in to. And even in recent years they've been better about letting you opt out of certain parts of it.
- rohitarondekar 15y agoWhy is this being down voted? It's true.
- grabastic 15y agoHow do you minify and concatenate your files in your projects? Part of a deploy/build script? Commit hooks? Manually? Do you do it at all? What about compiling Sass and CoffeeScript? The asset pipeline is not arrogance it's convenience. If you have a better system for those tasks then you shouldn't use the pipeline, but for a lot of people the asset pipeline saves time and results in a faster, better experience for their end users.
- zachrose 15y ago+1. I've watched people reinvent the asset pipeline on top of the asset pipeline.
- malandrew 15y agoCompletely agree. However, instead of bundling one asset pipeline into rails that is "aggressive" like Sprockets about getting into everything, they should have said "here's a connector" where you can attach the "asset pipeline" of your choice and let the community create the tools it needs for different scenarios, such as one asset pipeline for thin clients and another for think clients. Or separate asset pipelines for sass/css and coffeescript/javascript. Bundling a default that doesn't play well with lots of the client-side innovations hurts rails more than helps. The asset pipeline as it is currently designed is monolithic and an all or nothing approach.
- apsurd 15y agoI got downvoted into oblivion (deservedly so) because of my snark. But this is essentially the point I was trying to make. Rails is good at ruby. It was never good at javascript. Remember rjs? Remember inlining ajax handlers? Now we have default coffee script and sass file _per_ view. I know they mean well but javascript is its own beast! I really don't want to have to consciously disable all these things that are supposed to "be convenient" just because I know my way around javascript enough to not co-mangle it in with ruby.