From e98c3b16c527a9187c50a2e7ad79033facdf6cfd Mon Sep 17 00:00:00 2001 From: Nick Quaranto Date: Fri, 9 Oct 2009 15:31:20 -0400 Subject: [PATCH] Handle array template locations too --- lib/hassle.rb | 11 ++++++++--- spec/hassle_spec.rb | 13 +++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/hassle.rb b/lib/hassle.rb index 86e6c97..68fa307 100644 --- a/lib/hassle.rb +++ b/lib/hassle.rb @@ -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") diff --git a/spec/hassle_spec.rb b/spec/hassle_spec.rb index 21dd594..cc9764f 100644 --- a/spec/hassle_spec.rb +++ b/spec/hassle_spec.rb @@ -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