nex3/haml — Issue #447: The version of SASS that's vendored has a bug in its handling of !important
Author: edruder
Created: 2011-10-21 16:56:45+00:00
State: open

A style like this:

```
background: unquote("transparent #{$sprite} 0 -609px no-repeat !important")
```

causes SASS to throw an exception. (The problem is in `Sass::Engine#parse_property`.)

The latest version of SASS handles `!important` much differently--the code doesn't look like it has the problem. I think vendoring the latest version of SASS may fix the problem.

P.S. The SASS `engine.rb` file has changed so much in this area, and it doesn't look like there's a maintained branch with the problem code in it, so I didn't bother pushing a fix back to SASS. However, if it's hard to vendor the latest SASS in HAML, below is a fixed `Sass::Engine#parse_property`:

``` ruby
def parse_property(name, parsed_name, value, prop, line)
if value.strip.empty?
expr = Sass::Script::String.new("")
else
index = line.text.index(value)
important = false
if value =~ Sass::SCSS::RX::IMPORTANT
important = true
value = value.gsub(Sass::SCSS::RX::IMPORTANT,"")
end
expr = parse_script(value, :offset => line.offset + index)

end
Tree::PropNode.new(parse_interp(name), expr, important, prop)
end
```