Sha256: 9a09c1bf94dbc3621ed1e5495f0afcf6af5d3c0534fdade69b8e12d8a411e0fa

Contents?: true

Size: 459 Bytes

Versions: 8

Compression:

Stored size: 459 Bytes

Contents

class SCSSBeautifier::Formatters::EmptyRule < SCSSBeautifier::Formatters::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

8 entries across 8 versions & 1 rubygems

Version Path
scss_beautifier-0.1.19 lib/scss_beautifier/formatters/empty_rule.rb
scss_beautifier-0.1.18 lib/scss_beautifier/formatters/empty_rule.rb
scss_beautifier-0.1.17 lib/scss_beautifier/formatters/empty_rule.rb
scss_beautifier-0.1.16 lib/scss_beautifier/formatters/empty_rule.rb
scss_beautifier-0.1.15 lib/scss_beautifier/formatters/empty_rule.rb
scss_beautifier-0.1.14 lib/scss_beautifier/formatters/empty_rule.rb
scss_beautifier-0.1.13 lib/scss_beautifier/formatters/empty_rule.rb
scss_beautifier-0.1.12 lib/scss_beautifier/formatters/empty_rule.rb