diff --git a/lib/compass/sass_extensions/functions/env.rb b/lib/compass/sass_extensions/functions/env.rb index 849a2995..22b334cc 100644 --- a/lib/compass/sass_extensions/functions/env.rb +++ b/lib/compass/sass_extensions/functions/env.rb @@ -12,5 +12,8 @@ module Compass::SassExtensions::Functions::Env alias :current_date :current_time + def current_source_file + Sass::Script::String.new(options[:filename].to_s) + end end diff --git a/test/fixtures/stylesheets/envtest/css/env.css b/test/fixtures/stylesheets/envtest/css/env.css index aa8a733f..28122637 100644 --- a/test/fixtures/stylesheets/envtest/css/env.css +++ b/test/fixtures/stylesheets/envtest/css/env.css @@ -3,4 +3,6 @@ .time { time: "<%= Time.now.strftime("%F") %>"; } .date { - date: "<%= Time.now.strftime("%F") %>"; } \ No newline at end of file + date: "<%= Time.now.strftime("%F") %>"; } +.filename { + file: <%= filename.gsub(%r{/scss/}, '/sass/') %>; } \ No newline at end of file diff --git a/test/fixtures/stylesheets/envtest/sass/env.scss b/test/fixtures/stylesheets/envtest/sass/env.scss index 60e8a69c..4dad0709 100644 --- a/test/fixtures/stylesheets/envtest/sass/env.scss +++ b/test/fixtures/stylesheets/envtest/sass/env.scss @@ -8,4 +8,8 @@ .date { date: current-date("%F"); +} + +.filename { + file: current-source-file(); } \ No newline at end of file diff --git a/test/integrations/compass_test.rb b/test/integrations/compass_test.rb index b06f1283..99724085 100644 --- a/test/integrations/compass_test.rb +++ b/test/integrations/compass_test.rb @@ -140,6 +140,7 @@ private for name in arguments actual_result_file = "#{tempfile_path(@current_project)}/#{name}.css" expected_result_file = "#{result_path(@current_project)}/#{name}.css" + @filename = expected_result_file.gsub('css', 'scss') actual_lines = File.read(actual_result_file) actual_lines.gsub!(/^@charset[^;]+;/,'') if options[:ignore_charset] actual_lines = actual_lines.split("\n").reject{|l| l=~/\A\Z/} @@ -221,4 +222,8 @@ private File.join(project_path(project_name), "saved") end + def filename + @filename + end + end