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:
parent
6cc604a656
commit
7861b24690
1 changed files with 8 additions and 2 deletions
|
@ -216,6 +216,10 @@ END
|
||||||
' sass --watch input-dir:output-dir') do
|
' sass --watch input-dir:output-dir') do
|
||||||
@options[:watch] = true
|
@options[:watch] = true
|
||||||
end
|
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',
|
opts.on('-t', '--style NAME',
|
||||||
'Output style. Can be nested (default), compact, compressed, or expanded.') do |name|
|
'Output style. Can be nested (default), compact, compressed, or expanded.') do |name|
|
||||||
@options[:for_engine][:style] = name.to_sym
|
@options[:for_engine][:style] = name.to_sym
|
||||||
|
@ -249,14 +253,16 @@ END
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if @options[:watch]
|
if @options[:watch] || @options[:update]
|
||||||
require 'sass'
|
require 'sass'
|
||||||
require 'sass/plugin'
|
require 'sass/plugin'
|
||||||
dirs, files = @args.map {|name| name.split(':', 2)}.
|
dirs, files = @args.map {|name| name.split(':', 2)}.
|
||||||
map {|from, to| [from, to || from.gsub(/\..*?$/, '.css')]}.
|
map {|from, to| [from, to || from.gsub(/\..*?$/, '.css')]}.
|
||||||
partition {|i, _| File.directory? i}
|
partition {|i, _| File.directory? i}
|
||||||
::Sass::Plugin.options[:template_location] = dirs
|
::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
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue