class Sass::Tree::CommentNode

@see Sass::Tree
A static node representing a Sass comment (silent or loud).

def ==(other)

Returns:
  • (Boolean) - Whether or not this node and the other object

Parameters:
  • other (Object) -- The object to compare with
def ==(other)
  self.class == other.class && value == other.value && silent == other.silent
end

def _perform(environment)

Other tags:
    See: Sass::Tree -

Returns:
  • (Tree::Node, Array) - The resulting static nodes

Parameters:
  • environment (Sass::Environment) -- The lexical environment containing
def _perform(environment)
  return [] if @silent
  self
end

def _to_s(tabs = 0, _ = nil)

Other tags:
    See: #invisible? -

Returns:
  • (String, nil) - The resulting CSS

Parameters:
  • tabs (Fixnum) -- The level of indentation for the CSS

Overloads:
  • to_s(tabs = 0)
def _to_s(tabs = 0, _ = nil)
  return if invisible?
  spaces = ('  ' * [tabs - 1 - value[/^ */].size, 0].max)
  content = value.gsub(/^/, spaces)
  content.gsub!(/\n +(\* *)?/, ' ') if style == :compact
  content
end

def initialize(value, silent)

Parameters:
  • silent (Boolean) -- See \{#silent}
  • value (String) -- See \{#value}
def initialize(value, silent)
  @lines = []
  @value = normalize_indentation value
  @silent = silent
  super()
end

def invisible?

Returns:
  • (Boolean) -
def invisible?
  style == :compressed || @silent
end

def normalize_indentation(str)

def normalize_indentation(str)
  pre = str.split("\n").inject(str[/^[ \t]*/].split("")) do |pre, line|
    line[/^[ \t]*/].split("").zip(pre).inject([]) do |arr, (a, b)|
      break arr if a != b
      arr + [a]
    end
  end.join
  str.gsub(/^#{pre}/, '')
end

def to_sass(tabs, opts = {})

Other tags:
    See: Node#to_sass -
def to_sass(tabs, opts = {})
  content = value.gsub(/\*\/$/, '').rstrip
  if content =~ /\A[ \t]/
    # Re-indent SCSS comments like this:
    #     /* foo
    #   bar
    #       baz */
    content.gsub!(/^/, '   ')
    content.sub!(/\A([ \t]*)\/\*/, '/*\1')
  end
  content =
    unless content.include?("\n")
      content
    else
      content.gsub!(/\n( \*|\/\/)/, "\n  ")
      spaces = content.scan(/\n( *)/).map {|s| s.first.size}.min
      sep = silent ? "\n//" : "\n *"
      if spaces >= 2
        content.gsub(/\n  /, sep)
      else
        content.gsub(/\n#{' ' * spaces}/, sep)
      end
    end
  content.gsub!(/\A\/\*/, '//') if silent
  content.gsub!(/^/, '  ' * tabs)
  content.rstrip + "\n"
end

def to_scss(tabs, opts = {})

Other tags:
    See: Node#to_scss -
def to_scss(tabs, opts = {})
  spaces = ('  ' * [tabs - value[/^ */].size, 0].max)
  if silent
    value.gsub(/^[\/ ]\*/, '//').gsub(/ *\*\/$/, '')
  else
    value
  end.gsub(/^/, spaces) + "\n"
end