diff --git a/lib/middleman/helpers.rb b/lib/middleman/helpers.rb index 2af4b9e1..8eabea96 100644 --- a/lib/middleman/helpers.rb +++ b/lib/middleman/helpers.rb @@ -16,10 +16,10 @@ module Middleman path << self.class.index_file if path.match(%r{/$}) path = path.gsub(%r{^/}, '') path = path.gsub(File.extname(path), '') - path = path.gsub('/', '-') - css_file = File.join(File.basename(self.class.public), self.class.css_dir, "#{path}.css") - sass_file = File.join(File.basename(self.class.views), self.class.css_dir, "#{path}.css.sass") + css_file = File.join(self.class.public, self.class.css_dir, "#{path}.css") + sass_file = File.join(self.class.views, self.class.css_dir, "#{path}.css.sass") + if File.exists?(css_file) || File.exists?(sass_file) stylesheet_link_tag "#{path}.css" end diff --git a/spec/fixtures/sample/init.rb b/spec/fixtures/sample/init.rb index 8eba2f2e..33b25cde 100644 --- a/spec/fixtures/sample/init.rb +++ b/spec/fixtures/sample/init.rb @@ -1,4 +1,29 @@ # enable :maruku get "/inline-js.html" do haml :"inline-js.html", :layout => false +end + + +get "/page-class.html" do + haml :"page-classes.html", :layout => false +end + +get "/sub1/page-class.html" do + haml :"page-classes.html", :layout => false +end + +get "/sub1/sub2/page-class.html" do + haml :"page-classes.html", :layout => false +end + +get "/auto-css.html" do + haml :"auto-css.html", :layout => false +end + +get "/sub1/auto-css.html" do + haml :"auto-css.html", :layout => false +end + +get "/sub1/sub2/auto-css.html" do + haml :"auto-css.html", :layout => false end \ No newline at end of file