[Compass Core] Added a color-stop function to simplify the creation of gradients with multiple stop points.
This commit is contained in:
parent
c1052c3d3e
commit
11a354e47e
@ -1,7 +1,7 @@
|
|||||||
module Compass::SassExtensions::Functions
|
module Compass::SassExtensions::Functions
|
||||||
end
|
end
|
||||||
|
|
||||||
%w(selectors enumerate urls display inline_image).each do |func|
|
%w(selectors enumerate urls display inline_image color_stop).each do |func|
|
||||||
require "compass/sass_extensions/functions/#{func}"
|
require "compass/sass_extensions/functions/#{func}"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -11,6 +11,7 @@ module Sass::Script::Functions
|
|||||||
include Compass::SassExtensions::Functions::Urls
|
include Compass::SassExtensions::Functions::Urls
|
||||||
include Compass::SassExtensions::Functions::Display
|
include Compass::SassExtensions::Functions::Display
|
||||||
include Compass::SassExtensions::Functions::InlineImage
|
include Compass::SassExtensions::Functions::InlineImage
|
||||||
|
include Compass::SassExtensions::Functions::ColorStop
|
||||||
end
|
end
|
||||||
|
|
||||||
# Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
|
# Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
|
||||||
|
10
lib/compass/sass_extensions/functions/color_stop.rb
Normal file
10
lib/compass/sass_extensions/functions/color_stop.rb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
module Compass::SassExtensions::Functions::ColorStop
|
||||||
|
def color_stop(*args)
|
||||||
|
raise Sass::SyntaxError, "An even number of arguments must be passed to color-stop()" unless args.size % 2 == 0
|
||||||
|
stops = []
|
||||||
|
while args.size > 0
|
||||||
|
stops << "color-stop(#{args.shift}, #{args.shift})"
|
||||||
|
end
|
||||||
|
Sass::Script::String.new(stops.join(", "))
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user