Added Ace::SassFilter.
This commit is contained in:
parent
fa513bdbc7
commit
5a44c04d9a
1 changed files with 24 additions and 0 deletions
24
lib/ace/filters/sass.rb
Normal file
24
lib/ace/filters/sass.rb
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
|
||||||
|
require "sass"
|
||||||
|
require "ace/filters"
|
||||||
|
|
||||||
|
module Ace
|
||||||
|
class SassFilter < Filter
|
||||||
|
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
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue