Skip to content

Task for GrumPHP that adds CSS linting support with stylelint. An easy way to enforce convention and avoid errors in your styles

License

Notifications You must be signed in to change notification settings

adrifkat/grumphp-stylelint-task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

Task for GrumPHP that adds CSS linting support with stylelint. An easy way to enforce convention and avoid errors in your styles

Topics

Resources

License

Stars

Watchers

Forks

Languages