Rails v2.3.8 or v3.0.0b4
The directory structure is similar in public/stylesheets, as well. This essentially namespaces your directories so they are easier to organise. You need to only place files that are used in that specific namespace in the directory. If you use the library in more than one namespace, it should be placed in a “common” folder.
The “dev” folder is used locally, and is replaced with a cached version somewhere else on the Internet in production. More on that later…
View Helper Methods
You will need to include a couple of helpers in your layout files:
stylesheet_bundle - Exactly the same as above, but for CSS files.
Included Rake tasks are:
rake assemble:css - Only assembles namespaced CSS
You can handle these tasks on deployment by doing the following:
Assemblage Configuration and Ordering Files within a Bundle
To order the files within each bundle you may create a file config/assemblage.rb within your Rails application that provides the specific list of files and their order. For example:
bundle :widget, :js, 'jquery-1.4.4.min.js', 'jquery-ui-1.8.7.custom.min.js', 'jquery.maskedinput.js', 'raphael-1.5.2.min.js', 'jquery.ba-postmessage.0.5.min.js' bundle :app, :js, 'jquery-1.4.4.min.js', 'jquery-ui-1.8.7.custom.min.js', 'farbtastic' bundle :app, :css, 'site', 'jquery-ui-1.8.7.custom.css', 'farbtastic'
Issues & Contributions
For all issues and bug/feature requests, please use the GitHub issue tracker:
Very helpful article: Static Asset Bundling with Ruby on Rails By: Todd Fisher.
Thanks to Kyle Neath for the inspiration to turn his idea into a useful plugin for all!
Copyright © 2010 Josh Delsman, released under the MIT license