Sha256: e9673fe19c0ab8c7c3ba93f4dc59c5c3dcde74cecafd62da4556adbc94e3674d

Contents?: true

Size: 356 Bytes

Versions: 2

Compression:

Stored size: 356 Bytes

Contents

require 'json'
require 'set'

module HtmlScssClassChecker
  class ClassExtractor
    def self.extract_from_html(content)
      content.scan(/class="([^"]+)"/).flatten.map { |cls| cls.split }.flatten.to_set
    end

    def self.extract_from_scss(content)
      content.scan(/\.[\w-]+/).flatten.map { |cls| cls.delete_prefix('.') }.to_set
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
html_scss_class_checker-0.2.1 lib/html_scss_class_checker/class_extractor.rb
html_scss_class_checker-0.2.0 lib/html_scss_class_checker/class_extractor.rb