Sha256: 5bf853adf6831b545514fdc7cb17798eb5df75b22798f8823009fc165cbcc861

Contents?: true

Size: 574 Bytes

Versions: 11

Compression:

Stored size: 574 Bytes

Contents

class SCSSBeautifier::Formatters::BorderZero < Sass::Tree::Visitors::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

11 entries across 11 versions & 1 rubygems

Version Path
scss_beautifier-0.1.11 lib/scss_beautifier/formatters/border_zero.rb
scss_beautifier-0.1.10 lib/scss_beautifier/formatters/border_zero.rb
scss_beautifier-0.1.8 lib/scss_beautifier/formatters/border_zero.rb
scss_beautifier-0.1.7 lib/scss_beautifier/formatters/border_zero.rb
scss_beautifier-0.1.6 lib/scss_beautifier/formatters/border_zero.rb
scss_beautifier-0.1.5 lib/scss_beautifier/formatters/border_zero.rb
scss_beautifier-0.1.4 lib/scss_beautifier/formatters/border_zero.rb
scss_beautifier-0.1.3 lib/scss_beautifier/formatters/border_zero.rb
scss_beautifier-0.1.2 lib/scss_beautifier/formatters/border_zero.rb
scss_beautifier-0.1.1 lib/scss_beautifier/formatters/border_zero.rb
scss_beautifier-0.1.0 lib/scss_beautifier/formatters/border_zero.rb