diff --git a/doc-src/SASS_CHANGELOG.md b/doc-src/SASS_CHANGELOG.md index 2a7fba0b13..bc500aa567 100644 --- a/doc-src/SASS_CHANGELOG.md +++ b/doc-src/SASS_CHANGELOG.md @@ -10,6 +10,8 @@ * When printing a Sass error into a CSS comment, escape `*/` so the comment doesn't end prematurely. +* Preserve the `!` in `/*! ... */`-style comments. + ## 3.2.9 * Fix a bug where `@extend`s would occasionally cause a selector to be generated diff --git a/lib/sass/engine.rb b/lib/sass/engine.rb index 7695d42795..5e8740713c 100644 --- a/lib/sass/engine.rb +++ b/lib/sass/engine.rb @@ -637,7 +637,6 @@ def parse_comment(line) value = [line.text] else value = self.class.parse_interp(line.text, line.index, line.offset, :filename => @filename) - value[0].slice!(2) if loud # get rid of the "!" end value = with_extracted_values(value) do |str| str = str.gsub(/^#{line.comment_tab_str}/m, '')[2..-1] # get rid of // or /* diff --git a/lib/sass/scss/parser.rb b/lib/sass/scss/parser.rb index 5bf39d6a96..5844a142a5 100644 --- a/lib/sass/scss/parser.rb +++ b/lib/sass/scss/parser.rb @@ -120,7 +120,6 @@ def process_comment(text, node) value = [text.sub(/^\s*\/\//, '/*').gsub(/^\s*\/\//, ' *') + ' */'] else value = Sass::Engine.parse_interp(text, line, @scanner.pos - text.size, :filename => @filename) - value[0].slice!(2) if loud # get rid of the "!" value.unshift(@scanner. string[0...@scanner.pos]. reverse[/.*?\*\/(.*?)($|\Z)/, 1]. diff --git a/lib/sass/tree/visitors/convert.rb b/lib/sass/tree/visitors/convert.rb index 62ae782345..56c290f78c 100644 --- a/lib/sass/tree/visitors/convert.rb +++ b/lib/sass/tree/visitors/convert.rb @@ -89,7 +89,6 @@ def visit_comment(node) end.gsub(/^/, spaces) + "\n" content end - content.sub!(%r{^\s*(/\*)}, '/*!') if node.type == :loud #' content end diff --git a/test/sass/engine_test.rb b/test/sass/engine_test.rb index fa2155c28d..a325167a4a 100755 --- a/test/sass/engine_test.rb +++ b/test/sass/engine_test.rb @@ -1804,7 +1804,7 @@ def test_loud_comment_with_separate_line_close def test_loud_comment_in_compressed_mode assert_equal < :compressed) -foo{color:blue;/* foo +foo{color:blue;/*! foo * bar */} CSS @@ -1818,7 +1818,8 @@ def test_loud_comment_in_compressed_mode def test_loud_comment_is_evaluated assert_equal <