Sha256: 7386a9ccba8a304e4c4cdd1194feb9180d9f806ffed8464da5554319623f8b37
Contents?: true
Size: 747 Bytes
Versions: 3
Compression:
Stored size: 747 Bytes
Contents
module SCSSLint # Checks for quotes in URLs. class Linter::UrlQuotes < Linter include LinterRegistry def visit_prop(node) case node.value.first when Sass::Script::Tree::Literal check(node, node.value.first.value.to_s) when Sass::Script::Tree::ListLiteral node.value.first .children .select { |child| child.is_a?(Sass::Script::Tree::Literal) } .each { |child| check(node, child.value.to_s) } end yield end private def check(node, string) return unless string.match?(/^\s*url\(\s*[^"']/) return if string.match?(/^\s*url\(\s*data:/) # Ignore data URIs add_lint(node, 'URLs should be enclosed in quotes') end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
scss_lint-0.60.0 | lib/scss_lint/linter/url_quotes.rb |
scss_lint-0.59.0 | lib/scss_lint/linter/url_quotes.rb |
scss_lint-0.58.0 | lib/scss_lint/linter/url_quotes.rb |