Class: Rake::Pipeline::Web::Filters::StylusFilter
- Inherits:
-
Filter
- Object
- Filter
- Rake::Pipeline::Web::Filters::StylusFilter
- Includes:
- FilterWithDependencies
- Defined in:
- lib/rake-pipeline-web-filters/stylus_filter.rb
Overview
A filter that compiles input files written in Stylus to CSS using the Stylus compiler
Requires rubygems.org/gems/stylus
You will need the ‘node` command on your runtime for this to work. See github.com/lucasmazza/ruby-stylus for more information.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #generate_output(inputs, output) ⇒ Object
-
#initialize(options = {}, &block) ⇒ StylusFilter
constructor
A new instance of StylusFilter.
Constructor Details
#initialize(options = {}, &block) ⇒ StylusFilter
Returns a new instance of StylusFilter.
33 34 35 36 37 |
# File 'lib/rake-pipeline-web-filters/stylus_filter.rb', line 33 def initialize(={}, &block) block ||= proc { |input| input.sub(/\.(styl)$/, '.css') } super(&block) @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
26 27 28 |
# File 'lib/rake-pipeline-web-filters/stylus_filter.rb', line 26 def @options end |
Instance Method Details
#generate_output(inputs, output) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rake-pipeline-web-filters/stylus_filter.rb', line 39 def generate_output(inputs, output) .each do |key, value| if key == :use Stylus.send key, *value next end Stylus.send "#{key}=", value end inputs.each do |input| output.write Stylus.compile(input.read) end end |