Sha256: dd2578094baeadf2205b38b3e05f57e3f7e60937edef74341a538ef35f7a3f51

Contents?: true

Size: 688 Bytes

Versions: 8

Compression:

Stored size: 688 Bytes

Contents

PSEUDO_ELEMENTS = File.read(File.realpath(File.join(File.dirname(__FILE__), "..", "..", "..", "data", "pseudo_elements.txt"))).split("\n")

class SCSSBeautifier::Formatters::PseudoElement < SCSSBeautifier::Formatters::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|
      return r unless r.is_a?(String)
      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

8 entries across 8 versions & 1 rubygems

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