Make the Sass filter in haml files pass the Sass::Plugin options when initializing the sass engine.

This commit is contained in:
Chris Eppstein 2008-09-03 10:36:14 -07:00
parent 21f261d3a7
commit 7512dbe093
3 changed files with 13 additions and 12 deletions

View File

@ -215,7 +215,7 @@ END
lazy_require 'sass/engine'
def render(text)
::Sass::Engine.new(text).render
::Sass::Engine.new(text,::Sass::Plugin.engine_options).render
end
end

View File

@ -34,6 +34,13 @@ module Sass
@@options.merge!(value)
end
# Get the options ready to be passed to the Sass::Engine
def engine_options(additional_options = {})
l_options = @@options.dup.merge(additional_options)
l_options[:load_paths] = load_paths(l_options)
l_options
end
# Checks each stylesheet in <tt>options[:css_location]</tt>
# to see if it needs updating,
# and updates it using the corresponding template
@ -53,9 +60,7 @@ module Sass
File.delete(css) if File.exists?(css)
filename = template_filename(name)
l_options = @@options.dup
l_options[:filename] = filename
l_options[:load_paths] = load_paths
l_options = engine_options(:filename => filename)
engine = Engine.new(File.read(filename), l_options)
result = begin
engine.render
@ -78,8 +83,8 @@ module Sass
private
def load_paths
(options[:load_paths] || []) + [options[:template_location]]
def load_paths(opts = options)
(opts[:load_paths] || []) + [options[:template_location]]
end
def exception_string(e)

View File

@ -1,11 +1,7 @@
<style>
p {
border-style: dotted;
border-width: 22px;
border-color: #ff00ff; }
p { border-style: dotted; border-width: 22px; border-color: #ff00ff; }
h1 {
font-weight: normal; }
h1 { font-weight: normal; }
</style>
TESTING HAHAHAHA!
<p>