added current-time and current-date sass functions
This commit is contained in:
parent
4e9f7407f9
commit
2cbeb25abe
@ -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
|
||||
|
@ -1,2 +1,6 @@
|
||||
.env {
|
||||
env: <%= options[:environment] %>; }
|
||||
.time {
|
||||
time: "<%= Time.now.strftime("%F") %>"; }
|
||||
.date {
|
||||
date: "<%= Time.now.strftime("%F") %>"; }
|
@ -1,3 +1,11 @@
|
||||
.env {
|
||||
env: compass-env();
|
||||
}
|
||||
|
||||
.time {
|
||||
time: current-time("%F");
|
||||
}
|
||||
|
||||
.date {
|
||||
date: current-date("%F");
|
||||
}
|
Loading…
Reference in New Issue
Block a user