In Files

Class Index [+]

Quicksearch

Less::StyleSheet::Mixin4

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.

Public Instance Methods

build(env) click to toggle source
Also aliased as: build_without_sass
Alias for: build_with_sass
build_with_sass(env) click to toggle source
    # File lib/sass/less.rb, line 15
15:       def build_with_sass(env)
16:         selectors.build(env, :mixin).each do |path|
17:           el = path.inject(env.root) do |current, node|
18:             current.descend(node.selector, node) or raise MixinNameError, "#{selectors.text_value} in #{env}"
19:           end
20:           if el.is_a?(Node::Mixin::Def)
21:             # Calling a mixin with arguments, which gets compiled to a Sass mixin
22:             env << Node::Mixin::Call.new(el, [], env)
23:           else
24:             # Calling a mixin without arguments, which gets compiled to @extend
25:             sel = selector_str(path)
26:             base = selector_str(selector_base(path))
27:             if base == sel
28:               env << Node::SassNode.new(Sass::Tree::ExtendNode.new([sel]))
29:             else
30:               Haml::Util.haml_warn WARNING: Sass doesn't support mixing in selector sequences.Replacing "#{sel}" with "@extend #{base}"
31:               env << Node::SassNode.new(Sass::Tree::CommentNode.new("// #{sel};", true))
32:               env << Node::SassNode.new(Sass::Tree::ExtendNode.new([base]))
33:             end
34:           end
35:         end
36:       end
Also aliased as: build
build_without_sass(env) click to toggle source
Alias for: build
selector_base(path) click to toggle source
    # File lib/sass/less.rb, line 43
43:       def selector_base(path)
44:         el, i = Haml::Util.enum_with_index(path).to_a.reverse.find {|e, i| e.selector !~ /^:{1,2}$/} ||
45:           [path.first, 0]
46:         sel = (el.selector =~ /^:{0,2}$/ ? el.selector : "")
47:         [Node::Element.new(el.name, sel)] + path[i+1..1]
48:       end
selector_str(path) click to toggle source
    # File lib/sass/less.rb, line 50
50:       def selector_str(path)
51:         path.map {|e| e.sass_selector_str}.join(' ').gsub(' :', ':')
52:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.