1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

[Sass] Add an --update flag that works like --watch but only runs once.

This commit is contained in:
Nathan Weizenbaum 2010-01-15 17:13:55 -08:00
parent 6cc604a656
commit 7861b24690

View file

@ -216,6 +216,10 @@ END
' sass --watch input-dir:output-dir') do
@options[:watch] = true
end
opts.on('--update', 'Compile files or directories to CSS.',
'Locations are set like --watch.') do
@options[:update] = true
end
opts.on('-t', '--style NAME',
'Output style. Can be nested (default), compact, compressed, or expanded.') do |name|
@options[:for_engine][:style] = name.to_sym
@ -249,14 +253,16 @@ END
return
end
if @options[:watch]
if @options[:watch] || @options[:update]
require 'sass'
require 'sass/plugin'
dirs, files = @args.map {|name| name.split(':', 2)}.
map {|from, to| [from, to || from.gsub(/\..*?$/, '.css')]}.
partition {|i, _| File.directory? i}
::Sass::Plugin.options[:template_location] = dirs
::Sass::Plugin.watch(files)
::Sass::Plugin.watch(files) if @options[:watch]
::Sass::Plugin.update_stylesheets(files) if @options[:update]
return
end