lib/scss_lint/utils.rb in scss-lint-0.10.0 vs lib/scss_lint/utils.rb in scss-lint-0.10.1
- old
+ new
@@ -21,9 +21,20 @@
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