Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix Microsoft.gradient issue with SASS asset compilation. Resolves #14.

  • Loading branch information...
commit 2ae648370e0666565253da9a72bae48563d741e2 1 parent 47187a2
Robert Jackson authored
View
2  lib/bootstrap-sass.rb
@@ -4,6 +4,8 @@ module Bootstrap
module Rails
class Engine < ::Rails::Engine
# Rails, will you please look in our vendor? kthx
+
+ paths["config/initializers"] << 'lib/bootstrap-sass/config'
end
end
end
View
14 lib/bootstrap-sass/config/bootstrap-sass.rb
@@ -0,0 +1,14 @@
+require 'sass'
+
+module Sass::Script::Functions
+ # 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.
+ 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
+ declare :ie_hex_str, [:color]
+end
View
14 lib/bootstrap-sass/config/sass-ie_hex_str.rb
@@ -0,0 +1,14 @@
+require 'sass'
+
+module Sass::Script::Functions
+ # 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.
+ 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
+ declare :ie_hex_str, [:color]
+end
View
6 vendor/assets/stylesheets/bootstrap/mixins.css.scss
@@ -166,7 +166,7 @@
background-image: -webkit-linear-gradient(left, $startColor, $endColor); // Safari 5.1+, Chrome 10+
background-image: -o-linear-gradient(left, $startColor, $endColor); // Opera 11.10
background-image: linear-gradient(left, $startColor, $endColor); // Le standard
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$startColor}', endColorstr='#{$endColor}', GradientType=1); // IE9 and down
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($startColor)}', endColorstr='#{ie-hex-str($endColor)}', GradientType=1); // IE9 and down
}
@mixin vertical-gradient($startColor: #555, $endColor: #333) {
background-color: $endColor;
@@ -178,7 +178,7 @@
background-image: -webkit-linear-gradient(top, $startColor, $endColor); // Safari 5.1+, Chrome 10+
background-image: -o-linear-gradient(top, $startColor, $endColor); // Opera 11.10
background-image: linear-gradient(top, $startColor, $endColor); // The standard
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$startColor}', endColorstr='#{$endColor}', GradientType=0); // IE9 and down
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($startColor)}', endColorstr='#{ie-hex-str($endColor)}', GradientType=0); // IE9 and down
}
@mixin directional-gradient($startColor: #555, $endColor: #333, $deg: 45deg) {
background-color: $endColor;
@@ -198,7 +198,7 @@
background-image: -ms-linear-gradient($startColor, $midColor $colorStop, $endColor);
background-image: -o-linear-gradient($startColor, $midColor $colorStop, $endColor);
background-image: linear-gradient($startColor, $midColor $colorStop, $endColor);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$startColor}', endColorstr='#{$endColor}', GradientType=0); // IE9 and down, gets no color-stop at all for proper fallback
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($startColor)}', endColorstr='#{ie-hex-str($endColor)}', GradientType=0); // IE9 and down, gets no color-stop at all for proper fallback
}
// Reset filters for IE
Please sign in to comment.
Something went wrong with that request. Please try again.