Smart asset packaging for Rails and Sinatra.
AssetPackager, but with the following changes:
- Git modified date/time for package version (only re-packages files that have been modified)
- Framework agnostic (adapters provided for Rails 2, Rails 3, and Sinatra)
gem install smart_asset
require 'sinatra/base' require 'smart_asset' class Application < Sinatra::Base include SmartAsset::Adapters::Sinatra end
By default, SmartAsset will look for assets in
cd to your project and run
If your project is Git version controlled, only the assets that have changed are repackaged.
Otherwise, all packages generate every time.
- Install SmartAsset
- Instead of running
rake asset:packager:build_all, run
You may add extra options to your
Below are the default values (excluding
You may use environment variables with the
smart_asset command to alter its behavior.
Output commands that are running, leave the tmp file around for inspection
Only compress a specific package
Use a default modified time other than Time.now for non-version controlled files
Get compression warnings from Closure Compiler and YUI Compressor
Forks and contributions to this project are much appreciated, but please make sure the specs run!
To run the basic specs:
There are also framework specs to make sure the helpers work in Rails 2, Rails 3, and Sinatra 1: