Skip to main content

Writing custom syntaxes

Custom syntaxes are PostCSS syntaxes written by the community to support other styling languages or CSS-in-JS libraries using the customSyntax option

To write one, familiarize yourself with PostCSS's how to write custom syntax guide.

Existing syntaxes that you can use for reference include:

We recommend creating a shared-config that:

  • extends the standard config
  • bundles your custom syntax
  • turns off any incompatible built-in rules

For example, if you're creating a syntax for a CSS-in-JS library called "foo" then we recommend creating a shared-config called "stylelint-config-standard-foo" with the following content:

{  "extends": ["stylelint-config-standard"],  "customSyntax": "postcss-foo",  "rules": {    "at-rule-no-unknown": null,    ..  }}