ace: uniq generating files. SassFilter: sass possible too; instead substitude extention, .scss|.sass will be removed
This commit is contained in:
parent
6200acce71
commit
8a5db0714d
2
bin/ace
2
bin/ace
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue