added current-time and current-date sass functions

This commit is contained in:
Scott Davis 2012-03-23 11:55:38 -04:00
parent 4e9f7407f9
commit 2cbeb25abe
3 changed files with 23 additions and 0 deletions

View File

@ -1,5 +1,16 @@
module Compass::SassExtensions::Functions::Env
def compass_env
Sass::Script::String.new((options[:compass][:environment] || "development").to_s)
end
def current_time(format)
time = Time.now.strftime(format.to_s)
Sass::Script::String.new(time.to_s)
end
alias :current_date :current_time
end

View File

@ -1,2 +1,6 @@
.env {
env: <%= options[:environment] %>; }
.time {
time: "<%= Time.now.strftime("%F") %>"; }
.date {
date: "<%= Time.now.strftime("%F") %>"; }

View File

@ -1,3 +1,11 @@
.env {
env: compass-env();
}
.time {
time: current-time("%F");
}
.date {
date: current-date("%F");
}