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' lazy_require 'sass/engine'
def render(text) def render(text)
::Sass::Engine.new(text).render ::Sass::Engine.new(text,::Sass::Plugin.engine_options).render
end end
end end

View File

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

View File

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