From 81d2a44ef4e7fd084279cc3602770725e85fc37f Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Fri, 23 Mar 2012 13:25:54 -0400 Subject: [PATCH] added current-output-file() --- lib/compass/sass_extensions/functions/env.rb | 4 ++++ test/fixtures/stylesheets/envtest/css/env.css | 4 +++- test/fixtures/stylesheets/envtest/sass/env.scss | 4 ++++ test/integrations/compass_test.rb | 6 +++++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/compass/sass_extensions/functions/env.rb b/lib/compass/sass_extensions/functions/env.rb index 22b334cc..5bffc860 100644 --- a/lib/compass/sass_extensions/functions/env.rb +++ b/lib/compass/sass_extensions/functions/env.rb @@ -16,4 +16,8 @@ module Compass::SassExtensions::Functions::Env Sass::Script::String.new(options[:filename].to_s) end + def current_output_file + Sass::Script::String.new(options[:css_filename].to_s) + end + end diff --git a/test/fixtures/stylesheets/envtest/css/env.css b/test/fixtures/stylesheets/envtest/css/env.css index 28122637..f665d58d 100644 --- a/test/fixtures/stylesheets/envtest/css/env.css +++ b/test/fixtures/stylesheets/envtest/css/env.css @@ -5,4 +5,6 @@ .date { date: "<%= Time.now.strftime("%F") %>"; } .filename { - file: <%= filename.gsub(%r{/scss/}, '/sass/') %>; } \ No newline at end of file + file: <%= filename.gsub(%r{/scss/}, '/sass/') %>; } +.output { + output: <%= output_file %>; } \ 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 4dad0709..ad6074a3 100644 --- a/test/fixtures/stylesheets/envtest/sass/env.scss +++ b/test/fixtures/stylesheets/envtest/sass/env.scss @@ -12,4 +12,8 @@ .filename { file: current-source-file(); +} + +.output { + output: current-output-file(); } \ No newline at end of file diff --git a/test/integrations/compass_test.rb b/test/integrations/compass_test.rb index 99724085..9c597d4b 100644 --- a/test/integrations/compass_test.rb +++ b/test/integrations/compass_test.rb @@ -138,7 +138,7 @@ private def assert_renders_correctly(*arguments) options = arguments.last.is_a?(Hash) ? arguments.pop : {} for name in arguments - actual_result_file = "#{tempfile_path(@current_project)}/#{name}.css" + @output_file = 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) @@ -226,4 +226,8 @@ private @filename end + def output_file + @output_file + end + end