Module: Compass::Core::SassExtensions::Functions::Env
- Extended by:
- SassDeclarationHelper, Sass::Script::Value::Helpers
- Included in:
- Sass::Script::Functions
- Defined in:
- lib/compass/core/sass_extensions/functions/env.rb
Constant Summary collapse
- DEFAULT_TIME =
identifier("%T%:z")
- DEFAULT_DATE =
identifier("%F")
- NOT_ABSOLUTE =
bool(false)
Instance Method Summary collapse
- #at_stylesheet_root ⇒ Object
- #compass_env ⇒ Object
- #compass_extensions ⇒ Object
- #current_date(format = DEFAULT_DATE) ⇒ Object
- #current_output_file(absolute = NOT_ABSOLUTE) ⇒ Object
- #current_source_file(absolute = NOT_ABSOLUTE) ⇒ Object
- #current_time(format = DEFAULT_TIME) ⇒ Object
Methods included from SassDeclarationHelper
Instance Method Details
#at_stylesheet_root ⇒ Object
66 67 68 |
# File 'lib/compass/core/sass_extensions/functions/env.rb', line 66 def at_stylesheet_root bool(environment.selector.nil?) end |
#compass_env ⇒ Object
5 6 7 8 |
# File 'lib/compass/core/sass_extensions/functions/env.rb', line 5 def compass_env compass_opts = [:compass] || {} identifier((compass_opts[:environment] || "development").to_s) end |
#compass_extensions ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/compass/core/sass_extensions/functions/env.rb', line 53 def compass_extensions exts = Sass::Util.ordered_hash(identifier("compass") => quoted_string(Compass::Core::VERSION)) if defined?(Compass::Frameworks::ALL) Compass::Frameworks::ALL.each do |framework| next if framework.name == "compass" exts[identifier(framework.name)] = framework.version ? quoted_string(framework.version) : bool(true); end end map(exts) end |
#current_date(format = DEFAULT_DATE) ⇒ Object
20 21 22 |
# File 'lib/compass/core/sass_extensions/functions/env.rb', line 20 def current_date(format = DEFAULT_DATE) current_time(format) end |
#current_output_file(absolute = NOT_ABSOLUTE) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/compass/core/sass_extensions/functions/env.rb', line 40 def current_output_file(absolute = NOT_ABSOLUTE) if absolute.to_bool identifier([:css_filename].to_s) else filename = Pathname.new([:css_filename].to_s) css_path = Pathname.new(Compass.configuration.css_path) relative_filename = filename.relative_path_from(css_path).to_s rescue filename identifier(relative_filename.to_s) end end |
#current_source_file(absolute = NOT_ABSOLUTE) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/compass/core/sass_extensions/functions/env.rb', line 27 def current_source_file(absolute = NOT_ABSOLUTE) if absolute.to_bool identifier([:original_filename].to_s) else filename = Pathname.new([:original_filename].to_s) sass_path = Pathname.new(Compass.configuration.sass_path) relative_filename = filename.relative_path_from(sass_path).to_s rescue filename identifier(relative_filename.to_s) end end |
#current_time(format = DEFAULT_TIME) ⇒ Object
12 13 14 15 |
# File 'lib/compass/core/sass_extensions/functions/env.rb', line 12 def current_time(format = DEFAULT_TIME) assert_type format, :String identifier(Time.now.strftime(format.value)) end |