Permalink
Browse files

Fix a perf bug with CommentNode#normalize_indentation.

When a single line had ridiculously long preceding whitespace,

Closes #337
  • Loading branch information...
1 parent 5b3ff8f commit a69ebc640121f78632f8000cbafb16237e5e5526 @nex3 nex3 committed Mar 28, 2012
Showing with 3 additions and 1 deletion.
  1. +2 −0 doc-src/SASS_CHANGELOG.md
  2. +1 −1 lib/sass/tree/comment_node.rb
View
2 doc-src/SASS_CHANGELOG.md
@@ -10,6 +10,8 @@
* Support the `@-moz-document` directive's non-standard `url-prefix` and
`domain` function syntax.
* Support the [`@supports` directive](http://www.w3.org/TR/css3-conditional/#at-supports).
+* Fix a performance issue when using `/*! */` comments with the Rails asset
+ pipeline.
## 3.1.15
View
2 lib/sass/tree/comment_node.rb
@@ -81,7 +81,7 @@ def normalize_indentation(str)
pre = str.split("\n").inject(str[/^[ \t]*/].split("")) do |pre, line|
line[/^[ \t]*/].split("").zip(pre).inject([]) do |arr, (a, b)|
break arr if a != b
- arr + [a]
+ arr << a
end
end.join
str.gsub(/^#{pre}/, '')

0 comments on commit a69ebc6

Please sign in to comment.