Class: Rake::Pipeline::Web::Filters::SassCompiler
- Inherits:
-
Filter
- Object
- Filter
- Rake::Pipeline::Web::Filters::SassCompiler
- Defined in:
- lib/rake-pipeline-web-filters/sass_compiler.rb
Overview
A filter that compiles input files written in SCSS to CSS using the Sass compiler and the Compass CSS framework.
Instance Attribute Summary collapse
-
#options ⇒ Hash
readonly
A hash of options to pass to Sass when compiling.
Instance Method Summary collapse
-
#generate_output(inputs, output) ⇒ Object
Implement the #generate_output method required by the Filter API.
-
#initialize(options = {}, &block) ⇒ SassCompiler
constructor
A new instance of SassCompiler.
Constructor Details
#initialize(options = {}, &block) ⇒ SassCompiler
Returns a new instance of SassCompiler.
30 31 32 33 34 35 36 37 |
# File 'lib/rake-pipeline-web-filters/sass_compiler.rb', line 30 def initialize(={}, &block) block ||= proc { |input| input.sub(/\.(scss|sass)$/, '.css') } super(&block) Compass.add_project_configuration @options = Compass.configuration. @options[:load_paths].concat(Array(.delete(:additional_load_paths))) @options.merge!() end |
Instance Attribute Details
#options ⇒ Hash (readonly)
Returns a hash of options to pass to Sass when compiling.
22 23 24 |
# File 'lib/rake-pipeline-web-filters/sass_compiler.rb', line 22 def @options end |
Instance Method Details
#generate_output(inputs, output) ⇒ Object
Implement the #generate_output method required by the Filter API. Compiles each input file with Sass.
47 48 49 50 51 |
# File 'lib/rake-pipeline-web-filters/sass_compiler.rb', line 47 def generate_output(inputs, output) inputs.each do |input| output.write Sass.compile(input.read, ) end end |