Sha256: d26d1cb19911c867b88468d8c431f1b099af10ff1d24c4714902f5587ddc9433

Contents?: true

Size: 580 Bytes

Versions: 8

Compression:

Stored size: 580 Bytes

Contents

class SCSSBeautifier::Formatters::BorderZero < SCSSBeautifier::Formatters::Base
  BORDER_PROPERTIES = %w[
    border
    border-top
    border-right
    border-bottom
    border-left
  ].freeze


  def visit_prop(node)
    return unless BORDER_PROPERTIES.include?(node.name.first.to_s)
    # return unless node.value.length == 1
    format_border(node.value)
  end

  def format_border(node)
    return unless Sass::Script::Tree::Literal === node
    return unless node.value.value == "0"
    node.instance_variable_set(:@value, Sass::Script::Value::String.new("none"))
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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