Rack task library for using Sprockets standalone.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install sprockets-standalone
Require sprockets-standalone in your Rakefile and define the task:
require 'sprockets/standalone' Sprockets::Standalone::RakeTask.new(:assets) do |task, sprockets| task.assets = %w(app.js app.css *.png *.svg *.woff) task.sources = %w(app/assets vendor/assets) task.output = File.expand_path('../assets', __FILE__) task.compress = false task.digest = false sprockets.js_compressor = :uglifier sprockets.css_compressor = :sass end
You can give a name to the task that will be used for namespacing. The example above will generate the rake tasks
assets:clean. Default value for name is
If you pass a block you can configure additional parameters:
task.assets - Defines the list of assets that should be compiled for you. By default it contains
task.source - Defines a list of source directories. The specified paths will be added to sprockets' include path. If you want a sprockets directory structure similar to Rails you need to add all paths:
task.output - Define output directory. Default is
task.compress - Set to true if you want pre-compressed assets. Default is false.
task.digest - Set to true if you want to include a file digest in the file name of generated assets. Default is false.
task.environment - Set custom sprockets environment.
You can also customize the sprockets environment in the block to configure additional preprocessors or compressors.
Note: Sprockets-standalone will always use a manifest.json even when asset digests are turned off. The manifest.json will be used to track changes. If you manually change the generated assets that will not be override when compiling assets unless there is also a change if the matching source files.
You will need to remove generated assets (
rake assets:clobber) to force regeneration of all assets.
- Fork it ( http://github.com/jgraichen/sprockets-standalone/fork )
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request