scss
#!/usr/bin/env ruby
require 'sass'
require 'sass/exec'
require 'sass/plugin'
%w[
updating_stylesheets
not_updating_stylesheet
creating_directory
updating_stylesheet
updated_stylesheet
template_modified
template_created
template_deleted
].each do |cb|
Sass::Plugin.send "on_#{cb}" do |*args|
# イベント発生の調査用
$stderr.puts "on_#{cb} (#{args.join(', ')})"
end
end
Sass::Plugin.on_compilation_error do |error, template, css|
puts error.class
if error.instance_of? Errno::ENOENT
exec "bundle exec ./scss --watch sass:css"
end
end
opts = Sass::Exec::Sass.new(ARGV)
opts.parse!