Package assets into gems for non-Rails applications.
$ gem install sprockets-plugin
Sprockets::Plugin is meant to be used within gems, to package assets for reuse. So the first step is to add it as a dependency in your gemspec:
Gem::Specification.new do |s| # ... s.add_runtime_dependency "sprockets-plugin" end
And then extend Sprockets::Plugin and add the necessary asset paths:
Now any assets in the "lib/assets" directory will be available to applications that require this gem:
You can package assets for Rails and non-Rails applications in the following way:
if defined? Rails require "my_assets/engine" elsif defined? Sprockets::Plugin require "my_assets/plugin" end
Copyright (c) 2011 Peter Browne. See LICENSE for details.