Skip to content

Commit

Permalink
Handle array template locations too
Browse files Browse the repository at this point in the history
  • Loading branch information
qrush committed Oct 9, 2009
1 parent 1dd83bf commit e98c3b1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/hassle.rb
Expand Up @@ -14,10 +14,15 @@ def css_location

def compile
setup
template_location = Sass::Plugin.options[:template_location]

if Sass::Plugin.options[:template_location]
Sass::Plugin.options[:template_location].keys.each do |key|
Sass::Plugin.options[:template_location][key] = css_location
if template_location.is_a?(Hash)
template_location.keys.each do |key|
template_location[key] = css_location
end
elsif template_location.is_a?(Array)
template_location.each do |location|
location[-1] = css_location
end
else
Sass::Plugin.options[:template_location] = File.join(Sass::Plugin.options[:css_location], "sass")
Expand Down
13 changes: 13 additions & 0 deletions spec/hassle_spec.rb
Expand Up @@ -65,5 +65,18 @@
sass_one.should be_compiled
sass_two.should be_compiled
end

it "should compile sass if template location is an array with multiple locations" do
location_one = "public/css/sass"
location_two = "public/stylesheets/sass"
sass_one = write_sass(location_one, "one")
sass_two = write_sass(location_two, "two")
Sass::Plugin.options[:template_location] = [[location_one, "public/css"], [location_two, "public/css"]]

@hassle.compile

sass_one.should be_compiled
sass_two.should be_compiled
end
end
end

0 comments on commit e98c3b1

Please sign in to comment.