[Compass Core] Fixed the append_selector function to allow comma-delimited selectors for both arguments instead of just the first.
This commit is contained in:
parent
f27e184c7f
commit
c9454190e7
22
lib/compass/installers/template_context.rb
Normal file
22
lib/compass/installers/template_context.rb
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
module Compass
|
||||||
|
module Installers
|
||||||
|
class TemplateContext
|
||||||
|
def self.ctx(*arguments)
|
||||||
|
new(*arguments).get_binding
|
||||||
|
end
|
||||||
|
def initialize(locals = {})
|
||||||
|
@locals = locals
|
||||||
|
end
|
||||||
|
def get_binding
|
||||||
|
@locals.each do |k, v|
|
||||||
|
eval("#{k} = v")
|
||||||
|
end
|
||||||
|
binding
|
||||||
|
end
|
||||||
|
def config
|
||||||
|
Compass.configuration
|
||||||
|
end
|
||||||
|
alias configuration config
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -33,7 +33,10 @@ module Compass::SassExtensions::Functions::Selectors
|
|||||||
# #{append_selector(!selector, !to_append)}
|
# #{append_selector(!selector, !to_append)}
|
||||||
# width: 2px
|
# width: 2px
|
||||||
def append_selector(selector, to_append)
|
def append_selector(selector, to_append)
|
||||||
Sass::Script::String.new(selector.value.split(COMMA_SEPARATOR).map{|s| "#{s}#{to_append}"}.join(", "))
|
ancestors = selector.value.split(COMMA_SEPARATOR)
|
||||||
|
descendants = to_append.value.split(COMMA_SEPARATOR)
|
||||||
|
nested = ancestors.map{|a| descendants.map{|d| "#{a}#{d}"}.join(", ")}.join(", ")
|
||||||
|
Sass::Script::String.new(nested)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user