Sha256: bb9cee71c464df3054ee3acd177e75a0a109edcc53ec68b7181ea3da06be95f7
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
module SCSSLint module Utils # Given a selector array which is a list of strings with Sass::Script::Nodes # interspersed within them, return an array of strings representing those # selectors with the Sass::Script::Nodes removed (i.e., ignoring # interpolation). For example: # # .selector-one, .selector-#{$var}-two # # becomes: # # .selector-one, .selector--two # # This is useful for lints that wish to ignore interpolation, since # interpolation can't be resolved at this step. def extract_string_selectors(selector_array) selector_array.reject { |item| item.is_a? Sass::Script::Node }. join. split end def node_has_bad_name?(node) node.name =~ /#{INVALID_NAME_CHARS}/ end def shortest_hex_form(hex) (can_be_condensed?(hex) ? (hex[0..1] + hex[3] + hex[5]) : hex).downcase end def can_be_condensed?(hex) hex.length == 7 && hex[1] == hex[2] && hex[3] == hex[4] && hex[5] == hex[6] end private INVALID_NAME_CHARS = '[_A-Z]' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
scss-lint-0.10.1 | lib/scss_lint/utils.rb |