implimented current-source-file()
This commit is contained in:
parent
2cbeb25abe
commit
60ed9581e2
@ -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
|
||||||
|
@ -4,3 +4,5 @@
|
|||||||
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/') %>; }
|
@ -9,3 +9,7 @@
|
|||||||
.date {
|
.date {
|
||||||
date: current-date("%F");
|
date: current-date("%F");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.filename {
|
||||||
|
file: current-source-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
|
||||||
|
Loading…
Reference in New Issue
Block a user