Skip to content

Commit

Permalink
[Sass] Add a --stop-on-error option.
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Aug 22, 2010
1 parent c38ba9f commit 7daefd9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions doc-src/SASS_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
* Don't require `rake` in the gemspec, for bundler compatibility under
JRuby. Thanks to [Gordon McCreight](http://www.gmccreight.com/blog).

* Add a command-line option `--stop-on-error` that causes Sass to exit
when a file fails to compile using `--watch` or `--update`.

## 3.0.17

[Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.17).
Expand Down
6 changes: 5 additions & 1 deletion lib/haml/exec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ def set_opts(opts)
'Locations are set like --watch.') do
@options[:update] = true
end
opts.on('--stop-on-error', 'If a file fails to compile, exit immediately.',
'Only meaningful for --watch and --update.') do
@options[:stop_on_error] = 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
Expand Down Expand Up @@ -426,7 +430,7 @@ def watch_or_update
::Sass::Plugin.on_creating_directory {|dirname| puts_action :directory, :green, dirname}
::Sass::Plugin.on_deleting_css {|filename| puts_action :delete, :yellow, filename}
::Sass::Plugin.on_compilation_error do |error, _, _|
raise error unless error.is_a?(::Sass::SyntaxError)
raise error unless error.is_a?(::Sass::SyntaxError) && !@options[:stop_on_error]
had_error = true
puts_action :error, :red, "#{error.sass_filename} (Line #{error.sass_line}: #{error.message})"
end
Expand Down

0 comments on commit 7daefd9

Please sign in to comment.