diff --git a/doc-src/SASS_CHANGELOG.md b/doc-src/SASS_CHANGELOG.md index d83042bd..57cf6ccc 100644 --- a/doc-src/SASS_CHANGELOG.md +++ b/doc-src/SASS_CHANGELOG.md @@ -250,6 +250,13 @@ Several bug fixes and minor improvements have been made, including: * Don't crash when `rake gems` is run in Rails with Sass installed. Thanks to [Florian Frank](http://github.com/flori). +* When raising a file-not-found error, + add a list of load paths that were checked. + +* If an import isn't found for a cached Sass file and the + {file:SASS_REFERENCE.md#full_exception `:full_exception option`} is enabled, + print the full exception rather than raising it. + ## 2.2.22 [Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.22). diff --git a/lib/sass/files.rb b/lib/sass/files.rb index 6cab7536..e6790355 100644 --- a/lib/sass/files.rb +++ b/lib/sass/files.rb @@ -79,7 +79,15 @@ If you really need #{filename}.css, import it explicitly. END return filename + '.css' end - raise SyntaxError.new("File to import not found or unreadable: #{original_filename}.") + + message = "File to import not found or unreadable: #{original_filename}.\n" + if load_paths.size == 1 + message << "Load path: #{load_paths.first}" + else + message << "Load paths:\n " << load_paths.join("\n ") + end + + raise SyntaxError.new(message) end private diff --git a/lib/sass/plugin.rb b/lib/sass/plugin.rb index 48ac3517..69433eb5 100644 --- a/lib/sass/plugin.rb +++ b/lib/sass/plugin.rb @@ -396,8 +396,13 @@ module Sass def dependency_updated?(css_mtime) lambda do |dep| - File.mtime(dep) > css_mtime || - dependencies(dep).any?(&dependency_updated?(css_mtime)) + begin + File.mtime(dep) > css_mtime || + dependencies(dep).any?(&dependency_updated?(css_mtime)) + rescue Sass::SyntaxError + # If there's an error finding depenencies, default to recompiling. + true + end end end diff --git a/test/sass/engine_test.rb b/test/sass/engine_test.rb index 67128e05..5140d15a 100755 --- a/test/sass/engine_test.rb +++ b/test/sass/engine_test.rb @@ -57,7 +57,12 @@ MSG "a," => "Rules can\'t end in commas.", "a,\n!b = 1" => ["Rules can\'t end in commas.", 1], "!a = b\n :c d\n" => "Illegal nesting: Nothing may be nested beneath variable declarations.", - "@import foo.sass" => "File to import not found or unreadable: foo.sass.", + "@import foo.sass" => < "Illegal nesting: Nothing may be nested beneath import directives.", "foo\n @import templates/basic" => "Import directives may only be used at the root of a document.", "foo\n @import #{File.dirname(__FILE__)}/templates/basic" => "Import directives may only be used at the root of a document.",