implimented current-source-file()

This commit is contained in:
Scott Davis 2012-03-23 13:19:25 -04:00
parent 2cbeb25abe
commit 60ed9581e2
4 changed files with 15 additions and 1 deletions

View File

@ -12,5 +12,8 @@ module Compass::SassExtensions::Functions::Env
alias :current_date :current_time alias :current_date :current_time
def current_source_file
Sass::Script::String.new(options[:filename].to_s)
end
end end

View File

@ -3,4 +3,6 @@
.time { .time {
time: "<%= Time.now.strftime("%F") %>"; } time: "<%= Time.now.strftime("%F") %>"; }
.date { .date {
date: "<%= Time.now.strftime("%F") %>"; } date: "<%= Time.now.strftime("%F") %>"; }
.filename {
file: <%= filename.gsub(%r{/scss/}, '/sass/') %>; }

View File

@ -8,4 +8,8 @@
.date { .date {
date: current-date("%F"); date: current-date("%F");
}
.filename {
file: current-source-file();
} }

View File

@ -140,6 +140,7 @@ private
for name in arguments for name in arguments
actual_result_file = "#{tempfile_path(@current_project)}/#{name}.css" actual_result_file = "#{tempfile_path(@current_project)}/#{name}.css"
expected_result_file = "#{result_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 = File.read(actual_result_file)
actual_lines.gsub!(/^@charset[^;]+;/,'') if options[:ignore_charset] actual_lines.gsub!(/^@charset[^;]+;/,'') if options[:ignore_charset]
actual_lines = actual_lines.split("\n").reject{|l| l=~/\A\Z/} actual_lines = actual_lines.split("\n").reject{|l| l=~/\A\Z/}
@ -221,4 +222,8 @@ private
File.join(project_path(project_name), "saved") File.join(project_path(project_name), "saved")
end end
def filename
@filename
end
end end