Sha256: d37ba06ce80743baceef306832c24dd5adb6267c509be206b25cbf47c759387f

Contents?: true

Size: 575 Bytes

Versions: 1

Compression:

Stored size: 575 Bytes

Contents

PSEUDO_ELEMENTS = File.read('./data/pseudo_elements.txt').split("\n")

class SCSSBeautifier::Formatters::PseudoElement < Sass::Tree::Visitors::Base
  def visit_rule(node)
    check_pseudo(node) if node.rule.join.match(/::?/)
    visit_children(node)
  end

  def check_pseudo(node)
    node.rule = Sass::Util.strip_string_array(node.rule.map { |r|
      require_double_colon = PSEUDO_ELEMENTS.index(r.split(":").last)

      colon_type = require_double_colon ? '::' : ':'

      r.gsub(/::?/, colon_type)
    })

    node.send(:try_to_parse_non_interpolated_rules)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scss_beautifier-0.1.0 lib/scss_beautifier/formatters/pseudo_element.rb