Class: Ace::SassFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/ace/filters/sass.rb

Instance Method Summary collapse

Methods inherited from Filter

#initialize

Constructor Details

This class inherits a constructor from Ace::Filter

Instance Method Details

#call(item, content) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ace/filters/sass.rb', line 8

def call(item, content)
  if item.output_path && item.output_path.end_with?(".scss")
    item.output_path.sub!(/scss$/, "css")
    begin
      engine = Sass::Engine.new(content, {:syntax => :scss})
      output = engine.render
    rescue Exception => e
      warn "~~ SassFilter exception: #{e}"
      abort
    end
    return output
  else
    return content
  end
end