rails-slow-assets-workaround

Speed up rails assets compilation splitting it in 2 phases.

Rails ~> 3.0 assets:precompile can be really slow, rails-slow-assets-workaround overcomes to this issue speeding up the assets compilation in a very simple way.

How it works

This gem only provides a new task: assets:compile that is responsible of compiling only those assets that are listed into config/assets.yml

Using it combined with assets:precompile can greatly reduce the deploy time of Rails apps with assets pipleline.

To avoid wait minutes at any deploy you can split the depoyment process it in 2 phases, add any assets you wish to recompile often to config/assets.yml, it's really fast if they are few, and compile them with assets:compile and leave the other to assets:precompile, so:

  • run assets:precompile (slow) once and for each time you add a new asset not listed in config/assets.yml.
  • run assets:compile (fast) on each deploy.

Install

gem 'rails-slow-assets-workaround'

Create config/assets.yml

And edit it eg.:

---
- admin/admin.css
- admin/admin.js
- site/site.css
- site/site.js

Usage

Run once

$ rake assets:compile

Copyright (c) 2012 mcasimir

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.