Module: Sass::Script::Functions
- Defined in:
- lib/flatstrap-sass/compass_functions.rb,
lib/flatstrap-sass/sass_functions.rb
Overview
This contains functions for use with a project only using Compass.
Instance Method Summary collapse
-
#ie_hex_str(color) ⇒ Object
LARS: Snatched from compass - 2011-11-29 - used for gradients in IE6-9 returns an IE hex string for a color with an alpha channel suitable for passing to IE filters.
- #image_path(source, options = {}) ⇒ Object
Instance Method Details
#ie_hex_str(color) ⇒ Object
LARS: Snatched from compass - 2011-11-29 - used for gradients in IE6-9 returns an IE hex string for a color with an alpha channel suitable for passing to IE filters.
7 8 9 10 11 12 |
# File 'lib/flatstrap-sass/sass_functions.rb', line 7 def ie_hex_str(color) assert_type color, :Color alpha = (color.alpha * 255).round alphastr = alpha.to_s(16).rjust(2, '0') Sass::Script::String.new("##{alphastr}#{color.send(:hex_str)[1..-1]}".upcase) end |
#image_path(source, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/flatstrap-sass/compass_functions.rb', line 3 def image_path(source, = {}) if defined?(::Sprockets) ::Sass::Script::String.new sprockets_context.image_path(source.value).to_s, :string elsif defined?(::Compass) image_url(source, Sass::Script::Bool.new(true)) else # Revert to the old compass-agnostic path determination asset_sans_quotes = source.value.gsub('"', '') Sass::Script::String.new("/images/#{asset_sans_quotes}", :string) end end |