Class | Sass::Tree::WarnNode
In: | lib/sass/tree/warn_node.rb
Parent: | Node

A dynamic node representing a Sass `@warn` statement.

@see Sass::Tree

### Methods

_perform new to_src

### Public Class methods

new(expr)

@param expr [Script::Node] The expression to print

[Source]

        # File lib/sass/tree/warn_node.rb, line 8
     8:       def initialize(expr)
     9:         @expr = expr
    10:         super()
    11:       end

### Protected Instance methods

_perform(environment)

Prints the expression to STDERR with a stylesheet trace.

@param environment [Sass::Environment] The lexical environment containing

      variable and mixin values

[Source]

        # File lib/sass/tree/warn_node.rb, line 24
    24:       def _perform(environment)
    25:         environment.push_frame(:filename => filename, :line => line)
    26:         res = @expr.perform(environment)
    27:         res = res.value if res.is_a?(Sass::Script::String)
    28:         msg = "WARNING: #{res}\n"
    29:         environment.stack.reverse.each_with_index do |entry, i|
    30:           msg << "        #{i == 0 ? "on" : "from"} line #{entry[:line]}" <<
    31:             " of #{entry[:filename] || "an unknown file"}"
    32:           msg << ", in `#{entry[:mixin]}'" if entry[:mixin]
    33:           msg << "\n"
    34:         end
    35:         Haml::Util.haml_warn msg
    36:         []
    37:       ensure
    38:         environment.pop_frame
    39:       end

to_src(tabs, opts, fmt)

@see Node#to_src

[Source]

        # File lib/sass/tree/warn_node.rb, line 16
    16:       def to_src(tabs, opts, fmt)
    17:         "#{'  ' * tabs}@warn #{@expr.to_sass(opts)}#{semi fmt}\n"
    18:       end

[Validate]