Module: Stylus::Sprockets
- Included in:
- Stylus
- Defined in:
- lib/stylus/sprockets.rb
Instance Method Summary collapse
-
#setup(environment, options = {}) ⇒ Object
Public: Configure a Sprockets environment with Stylus Tilt engine and the ImportProcessor.
Instance Method Details
#setup(environment, options = {}) ⇒ Object
Public: Configure a Sprockets environment with Stylus Tilt engine and the ImportProcessor. It also accept a configuration Hash to setup the load path and flags of the Stylus module.
environment - A instance of Sprockets::Environment. options - The configuration Hash (default: {})
:paths - An Array of paths to use the '@import' directive, defaults
to the `paths` attribute on the environment object.
:debug - The Boolean value for the debug flag.
:compress - The Boolean value for the debug compress.
Example
assets = Sprockets::Environment.new
Stylus.setup(assets, :compress => settings.production?)
Returns nothing.
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/stylus/sprockets.rb', line 35 def setup(environment, = {}) paths = [:paths] || environment.paths directories = paths.select { |dir| dir.to_s =~ /stylesheets$/ } Stylus.paths.concat(directories) Stylus.debug = .fetch(:debug, Stylus.debug) Stylus.compress = .fetch(:compress, Stylus.compress) environment.register_engine('.styl', Tilt::StylusTemplate) environment.register_preprocessor('text/css', Stylus::ImportProcessor) end |