class Sass::Tree::MixinNode

@see Sass::Tree
A dynamic node representing a mixin include.

def _perform(environment)

Other tags:
    See: Sass::Tree -

Raises:
  • (Sass::SyntaxError) - if an incorrect number of arguments was passed
  • (Sass::SyntaxError) - if there is no mixin with the given name

Returns:
  • (Array) - The resulting static nodes

Parameters:
  • environment (Sass::Environment) -- The lexical environment containing
def _perform(environment)
  raise Sass::SyntaxError.new("Undefined mixin '#{@name}'.", @line) unless mixin = environment.mixin(@name)
  raise Sass::SyntaxError.new(<<END.gsub("\n", "")) if mixin.args.size < @args.size
n #{@name} takes #{mixin.args.size} argument#{'s' if mixin.args.size != 1}
 #{@args.size} #{@args.size == 1 ? 'was' : 'were'} passed.
  environment = mixin.args.zip(@args).
    inject(Sass::Environment.new(mixin.environment)) do |env, ((var, default), value)|
    env.set_local_var(var.name,
      if value
        value.perform(environment)
      elsif default
        default.perform(env)
      end)
    raise Sass::SyntaxError.new("Mixin #{@name} is missing parameter #{var.inspect}.") unless env.var(var.name)
    env
  end
  mixin.tree.map {|c| c.perform(environment)}.flatten
end

def initialize(name, args)

Parameters:
  • args (Array) -- The arguments to the mixin
  • name (String) -- The name of the mixin
def initialize(name, args)
  @name = name
  @args = args
  super()
end