lib/scss_lint/utils.rb in scss_lint-0.38.0 vs lib/scss_lint/utils.rb in scss_lint-0.39.0
- old
+ new
@@ -33,9 +33,18 @@
# @return [String] 7-character hexadecimal code (includes `#` prefix)
def color_keyword_to_code(string)
Sass::Script::Value::Color::COLOR_NAMES[string]
end
+ # Returns whether a node is an IfNode corresponding to an @else/@else if
+ # statement.
+ #
+ # @param node [Sass::Tree::Node]
+ # @return [true,false]
+ def else_node?(node)
+ source_from_range(node.source_range).strip.start_with?('@else')
+ end
+
# 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:
#