Sha256: a311fa4a2c94b51ac53992370f3bd3445bcd5d5240e4fd396a7638d63f5c560d

Contents?: true

Size: 453 Bytes

Versions: 11

Compression:

Stored size: 453 Bytes

Contents

class SCSSBeautifier::Formatters::EmptyRule < Sass::Tree::Visitors::Base
  def visit_root(node)
    remove_empty_rule(node)
    yield
    remove_empty_rule(node)
  end
  def visit_rule(node)
    remove_empty_rule(node)
    visit_children(node)
    remove_empty_rule(node)
  end

  def remove_empty_rule(node)
    filtered = node.children.reject do |c|
      Sass::Tree::RuleNode === c && c.children.empty?
    end
    node.children = filtered
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
scss_beautifier-0.1.11 lib/scss_beautifier/formatters/empty_rule.rb
scss_beautifier-0.1.10 lib/scss_beautifier/formatters/empty_rule.rb
scss_beautifier-0.1.8 lib/scss_beautifier/formatters/empty_rule.rb
scss_beautifier-0.1.7 lib/scss_beautifier/formatters/empty_rule.rb
scss_beautifier-0.1.6 lib/scss_beautifier/formatters/empty_rule.rb
scss_beautifier-0.1.5 lib/scss_beautifier/formatters/empty_rule.rb
scss_beautifier-0.1.4 lib/scss_beautifier/formatters/empty_rule.rb
scss_beautifier-0.1.3 lib/scss_beautifier/formatters/empty_rule.rb
scss_beautifier-0.1.2 lib/scss_beautifier/formatters/empty_rule.rb
scss_beautifier-0.1.1 lib/scss_beautifier/formatters/empty_rule.rb
scss_beautifier-0.1.0 lib/scss_beautifier/formatters/empty_rule.rb