Class: Browsable::Analyzers::CSS

Inherits:
Base
  • Object
show all
Defined in:
lib/browsable/analyzers/css.rb

Overview

Audits CSS by shelling out to stylelint with the ‘stylelint-no-unsupported-browser-features` plugin configured for the project’s target. browsable supplies the config; stylelint (and its bundled caniuse data) does the actual compatibility reasoning.

Instance Attribute Summary

Attributes inherited from Base

#config, #target

Instance Method Summary collapse

Methods inherited from Base

compat_data, #initialize

Constructor Details

This class inherits a constructor from Browsable::Analyzers::Base

Instance Method Details

#analyze(files) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/browsable/analyzers/css.rb', line 15

def analyze(files)
  return [] if files.empty?

  argv = ["stylelint", "--config", write_stylelintrc,
          "--formatter", "json", *files]
  parse(shell_out(argv, dry_run_key: "BROWSABLE_DRY_RUN_CSS"))
end

#required_toolsObject



13
# File 'lib/browsable/analyzers/css.rb', line 13

def required_tools = ["stylelint"]