Sha256: d3d1a60031eda4e0fc17c5a0eb06efb8408d906250d0a2873f605cd9fe1bdc64

Contents?: true

Size: 644 Bytes

Versions: 8

Compression:

Stored size: 644 Bytes

Contents

PSEUDO_ELEMENTS = File.read(File.realpath(File.join(File.dirname(__FILE__), "..", "..", "..", "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

8 entries across 8 versions & 1 rubygems

Version Path
scss_beautifier-0.1.8 lib/scss_beautifier/formatters/pseudo_element.rb
scss_beautifier-0.1.7 lib/scss_beautifier/formatters/pseudo_element.rb
scss_beautifier-0.1.6 lib/scss_beautifier/formatters/pseudo_element.rb
scss_beautifier-0.1.5 lib/scss_beautifier/formatters/pseudo_element.rb
scss_beautifier-0.1.4 lib/scss_beautifier/formatters/pseudo_element.rb
scss_beautifier-0.1.3 lib/scss_beautifier/formatters/pseudo_element.rb
scss_beautifier-0.1.2 lib/scss_beautifier/formatters/pseudo_element.rb
scss_beautifier-0.1.1 lib/scss_beautifier/formatters/pseudo_element.rb