ace: uniq generating files. SassFilter: sass possible too; instead substitude extention, .scss|.sass will be removed

This commit is contained in:
Denis Knauf 2013-01-19 21:13:15 +01:00
parent 6200acce71
commit 8a5db0714d
2 changed files with 8 additions and 5 deletions

View file

@ -72,7 +72,7 @@ end
unless ARGV.include?("--no-generate")
puts
Ace::Item.all_instances.each do |item|
Ace::Item.all_instances.uniq.each do |item|
item.save!
end
end

View file

@ -6,19 +6,22 @@ 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")
if item.output_path && item.output_path.match(/\.s[ac]ss$/)
syntax = item.output_path.end_with?(".scss") ? :scss : :sass
item.output_path.sub!(/\.s[ac]ss$/, '')
output = nil
begin
engine = Sass::Engine.new(content, {:syntax => :scss})
engine = Sass::Engine.new(content, syntax: syntax, filename: item.original_path)
output = engine.render
rescue Exception => e
warn "~~ SassFilter exception: #{e}"
abort
end
#p caller: Kernel.caller
return output
else
return content
end
end
end
end
end