Module: Sass::Script::Functions

Defined in:
lib/bootstrap-sass/sass_functions.rb

Instance Method Summary collapse

Instance Method Details

#ie_hex_str(color) ⇒ Object

polyfill sass < 3.2.6 (taken from sass 3.2.12):



30
31
32
33
34
# File 'lib/bootstrap-sass/sass_functions.rb', line 30

def ie_hex_str(color)
  assert_type color, :Color, :color
  alpha = (color.alpha * 255).round.to_s(16).rjust(2, '0')
  Sass::Script::String.new("##{alpha}#{color.send(:hex_str)[1..-1]}".upcase)
end

#twbs_asset_path(source, type) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/bootstrap-sass/sass_functions.rb', line 15

def twbs_asset_path(source, type)
  url = if Bootstrap.asset_pipeline? && (context = sprockets_context)
          context.send(:"#{type}_path", source.value)
        elsif Bootstrap.compass?
          send(:"#{type}_url", source, Sass::Script::Bool.new(true)).value
        end

  # sass-only
  url ||= source.value.gsub('"', '')
  Sass::Script::String.new(url, :string)
end

#twbs_font_path(source) ⇒ Object



5
6
7
# File 'lib/bootstrap-sass/sass_functions.rb', line 5

def twbs_font_path(source)
  twbs_asset_path source, :font
end

#twbs_image_path(source) ⇒ Object



10
11
12
# File 'lib/bootstrap-sass/sass_functions.rb', line 10

def twbs_image_path(source)
  twbs_asset_path source, :image
end