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,15 +6,18 @@ 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
|
||||
|
|
Loading…
Reference in a new issue