lesshint-color-variable-linter

Linter for lesshint that enforces colors to be declared as variables

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
lesshint-color-variable-linter
000.0.16 years ago6 years agoMinified + gzip package size for lesshint-color-variable-linter in KB

Readme

Lesshint Color Variable Linter
npm

Example

invalid

.foo {
    color: red;
    background-color: #000000;
    border-color: rgb(0,0,0);
    text-decoration-color: rgba(0,0,0,1);
}

valid

.foo {
    color: @foo-color;
    background-color: @foo-background-color;
    border-color: @foo-border-color;
    text-decoration-color: @foo-decoration-color;
}

Install

$ npm install lesshint-color-variable-linter

Usage

In your lesshint.json configuration add the following:
"colorAsVariable" : {
    "enabled" : true,
    "severity" : "warning"
}

When running lesshint:
lesshint src/less/ lib/style.less --linters lesshint-color-variable-linter

Options

  • enabled: Turn on/off the linter rule. Values true or false.
  • severity: Severity levels of the linter. Values error or warning. Default is set to warning.