Sha256: 749d62a9e510ab2505c54c80a25969abac0559443f01469b1a6eb979825a4105

Contents?: true

Size: 510 Bytes

Versions: 2

Compression:

Stored size: 510 Bytes

Contents

class SCSSBeautifier::Formatters::LeadingZero < SCSSBeautifier::Formatters::Base
  LEADING_ZERO_REGEX = /\b0+\./
  # ExcludeZero Only
  def visit_prop(node)
    if Sass::Script::Tree::Literal === node.value && Sass::Script::Value::String === node.value.value
      node_value = node.value.value
      if node.value.value.to_s.match(LEADING_ZERO_REGEX)
        node.instance_variable_set(:@value, Sass::Script::Value::String.new(node.value.value.to_s.gsub(LEADING_ZERO_REGEX, '.')))
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scss_beautifier-0.1.19 lib/scss_beautifier/formatters/leading_zero.rb
scss_beautifier-0.1.18 lib/scss_beautifier/formatters/leading_zero.rb