1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

[Sass] Fix a bug that caused the Sass::Engine options to not get passed to the stylesheet environment.

This commit is contained in:
Chris Eppstein 2009-11-21 10:07:59 -08:00 committed by Nathan Weizenbaum
parent 4d7b19506b
commit dcb15c465c
4 changed files with 18 additions and 2 deletions

View file

@ -149,7 +149,6 @@ module Sass
# @raise [Sass::SyntaxError] if some element of the tree is invalid
# @see Sass::Tree
def perform(environment)
environment.options = @options if self.class == Tree::Node
_perform(environment)
rescue Sass::SyntaxError => e
e.modify_backtrace(:filename => filename, :line => line)

View file

@ -22,7 +22,8 @@ module Sass
end
# @see \{Node#perform}
def perform(*args)
def perform(environment)
environment.options = @options if environment.options.nil? || environment.options.empty?
super
rescue Sass::SyntaxError => e
e.sass_template = @template

View file

@ -967,6 +967,16 @@ a
SASS
end
def test_options_available_in_environment
assert_equal(<<CSS, render(<<SASS))
a {
b: nested; }
CSS
a
b= option("style")
SASS
end
# Encodings
unless Haml::Util.ruby1_8?

View file

@ -9,6 +9,12 @@ require 'sass'
Sass::RAILS_LOADED = true unless defined?(Sass::RAILS_LOADED)
module Sass::Script::Functions
def option(name)
Sass::Script::String.new(@options[name.value.to_sym].to_s)
end
end
class Test::Unit::TestCase
def munge_filename(opts)
return if opts[:filename]