A solution to assets management in Rails
rails-assets.org
rails-assets.org
Awesome! Was looking for something like this. I used to have a "vendorassets" directory where I could sanely manage 3rd party assets. Still a pain in the ass sometimes.
Rails-gems are usually out of date and everyone seems to jump the bower-ship.
Source control is not in itself a solution for dependency resolution. Sure, once your dependencies are worked out you can check them in, if you really want them hard-coded, but it shouldn't be necessary. Claiming so is a failure to understand how dependency resolution works -- part of the point of bower, or rubygems, or what have you, is knowing that you'll always get the same versions in all environments.
Riiight... because Github has never gone down and never will. ??? How would you propose to mitigate the risk of external repos being unavailable?
I'm writing from the perspective of real-world enterprise web application management best practices. This is not "failure to understand how dependency resolution works", it is "real world experience". Honestly, I don't think I've ever encountered someone with meaningful experience who hasn't come to the same conclusion. There's a first time for everything, I guess....
https://www.npmjs.org/doc/faq.html#Should-I-check-my-node_mo...
Sarcasm aside, I have to say I'm surprised at npm's best practices, but whatever. Personally, I'd rather not make my line count graph explode every time I add or remove a dependency. I still firmly believe that source control is not the only way to reliably vendor files.
$ bower install angular > /dev/null
$ find bower_components/angular/* | xargs wc -l
18 bower_components/angular/angular-csp.css
21463 bower_components/angular/angular.js
210 bower_components/angular/angular.min.js
141 bower_components/angular/angular.min.js.gzip
8 bower_components/angular/angular.min.js.map
7 bower_components/angular/bower.json
48 bower_components/angular/README.md
21895 total
That's 21893 more lines in this diff than the equivalent when using rails-assets.On other hand we're pretty close to the uptime of GitHub and we're not going anywhere, so I would't worry too much.
It's not hard to download a JavaScript or css file and put them in app/assets.
What warrants the additional complexity?
> Bower is a package manager for the web. It offers a generic, unopinionated solution to the problem of front-end package management, while exposing the package dependency model via an API that can be consumed by a more opinionated build stack.
rails-assets is an example of a higher-level, more opinionated stack that adds value on top of bower.
So you can't get reliably repeatable installs.
- creates manifest files for each component so you can just "require jquery" instead "require jquery/dist/jquery"
- splits assets in four categories: javascripts, stylesheets, images, fonts, so you can use sprockets helpers without a problem
- replaces relative urls in stylesheets with image-url font-url etc., so assets work out of the box
- converts .css files to .scss so you can get advantage of @import in SASS files
- you get assets locking with Gemfile.lock, so you can be sure each deploy will look the same. It's not possible yet with bower.
And few other sprockets integrations.
Unfortunately it's centralized solution but we're working on that.