From 0b435834bc37e26c016f2d29885ca3bfe08ae827 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 4 Dec 2011 19:13:37 -0800 Subject: [PATCH] Set the standard :css_filename option for sass. This enables relative path calculations for assets referred to by the stylesheet. --- lib/sass/rails/template_handlers.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/sass/rails/template_handlers.rb b/lib/sass/rails/template_handlers.rb index 1b3b31e..2350476 100644 --- a/lib/sass/rails/template_handlers.rb +++ b/lib/sass/rails/template_handlers.rb @@ -19,7 +19,7 @@ def resolve(path, content_type = :self) nil end - def public_path(path, scope) + def public_path(path, scope = nil) context.asset_paths.compute_public_path(path, ::Rails.application.config.assets.prefix) end @@ -72,14 +72,17 @@ def sass_options(scope) options = sass_options_from_rails(scope) load_paths = (options[:load_paths] || []).dup load_paths.unshift(importer) + resolver = Resolver.new(scope) + css_filename = File.join(::Rails.public_path, resolver.public_path(scope.logical_path)) + ".css" options.merge( :filename => eval_file, + :css_filename => css_filename, :line => line, :syntax => syntax, :importer => importer, :load_paths => load_paths, :custom => { - :resolver => Resolver.new(scope) + :resolver => resolver } ) end