Selector mixins that don't have arguments. This depends only on the syntax at the call site; if it doesn't use parens, it hits this production, regardless of whether the mixin being called has arguments or not.
# File lib/sass/less.rb, line 15 def build_with_sass(env) selectors.build(env, :mixin).each do |path| el = path.inject(env.root) do |current, node| current.descend(node.selector, node) or raise MixinNameError, "#{selectors.text_value} in #{env}" end if el.is_a?(Node::Mixin::Def) # Calling a mixin with arguments, which gets compiled to a Sass mixin env << Node::Mixin::Call.new(el, [], env) else # Calling a mixin without arguments, which gets compiled to @extend sel = selector_str(path) base = selector_str(selector_base(path)) if base == sel env << Node::SassNode.new(Sass::Tree::ExtendNode.new([sel])) else Sass::Util.sass_warn "WARNING: Sass doesn't support mixing in selector sequences. Replacing "#{sel}" with "@extend #{base}" " env << Node::SassNode.new(Sass::Tree::CommentNode.new("// #{sel};", true)) env << Node::SassNode.new(Sass::Tree::ExtendNode.new([base])) end end end end
# File lib/sass/less.rb, line 43 def selector_base(path) el, i = Sass::Util.enum_with_index(path).to_a.reverse.find {|e, i| e.selector !~ %r^:{1,2}$/} || [path.first, 0] sel = (el.selector =~ %r^:{0,2}$/ ? el.selector : "") [Node::Element.new(el.name, sel)] + path[i+1..-1] end
# File lib/sass/less.rb, line 50 def selector_str(path) path.map {|e| e.sass_selector_str}.join(' ').gsub(' :', ':') end