grumphp-stylelint-task
Installation
Stylelint is a static analysis tool for styles. A mighty, modern linter that helps you avoid errors and enforce conventions in your styles.
composer require --dev adrifkat/grumphp-stylelint-task
npm
1. Use npm to install stylelint and its standard configuration
:
npm install --save-dev stylelint stylelint-config-standard
2. Create a .stylelintrc.json
configuration file in the root of your project:
{
"extends": "stylelint-config-standard"
}
Config
It lives under the stylelint
namespace and has the following configurable parameters:
# grumphp.yml
grumphp:
tasks:
stylelint:
triggered_by: [css, scss, less]
whitelist_patterns:
- /^resources\/css\/(.*)/
config: .stylelintrc.json
max-warnings: 5
quiet: false
services:
Adrifkat\GrumPHPStylelint\StylelintTask:
arguments:
- '@process_builder'
- '@formatter.raw_process'
tags:
- { name: grumphp.task, task: stylelint }
triggered_by
Default: [less, sass, scss, css]
This is a list of extensions which will trigger the Stylelint task.
whitelist_patterns
Default: []
This is a list of regex patterns that will filter files to validate. With this option you can specify the folders containing style files and thus skip folders like the /vendor/ directory. This option is used in conjunction with the parameter triggered_by
. For example: to whitelist files in resources/css/
(Laravel's CSS directory) you can use:
whitelist_patterns:
- /^resources\/css\/(.*)/
config
Default: null
Path to a JSON, YAML, or JS file that contains your configuration object. Not necessary if using a standard stylelintrc name, eg. .stylelintrc.json
max-warnings
Default: null
Set a limit to the number of warnings accepted. (stylelint.io).
quiet
Default: null
Only register violations for rules with an "error"-level severity (ignore "warning"-level). (stylelint.io)