- Load your assets as nanoc's items
- Load and compile only the assets you want
- Configurable paths
Add nanoc-sprockets to you Gemfile.
In default.rb, require nanoc-sprockets:
Add a new entry in your nanoc.yaml.
data_sources: - type: sprockets items_root: /assets compile: - application.css - application.js path: assets css_compressor: scss js_compressor: uglifier
- items_root: the default prefix for you assets identifier
- compile: an array of js and css files to load as nanoc's items. Any other files are loaded automatically
- path: the path to the assets
- css_compressor: See sprockets minifying assets
- js_compressor: See sprockets minifying assets
- digest: The assets path will have a digest. You should toggle it to false during development.
- assets_host: Link to assets from a dedicated server.
Add specific rules for assets in Rules:
compile '/assets/*/' do end route '/assets/*/' do Sprockets::Helpers.asset_path(item[:filename]) end
To link to any assets, use the helpers providers by sprockets-helpers.
By default, digest of assets is not enabled. It means that js/css/images files are not concatened and the filename is preversed. Useful for development.
To enable digest, add to lib/default.rb:
Sprockets::Helpers.configure do |c| c.digest = true end
(c) 2014 Stormz