postcss-styl is a PostCSS parser plugin designed to convert Stylus syntax into a PostCSS Abstract Syntax Tree (AST). This allows developers to process Stylus code using the extensive PostCSS plugin ecosystem, enabling transformations like autoprefixing, minification, or custom linting. The current stable version is 0.12.3. The package maintains a fairly active release cadence, primarily addressing bug fixes related to AST correctness and stringification, as seen in recent versions. Its primary differentiator is providing a bridge between the Stylus language and PostCSS, allowing Stylus users to leverage PostCSS tools directly on their `.styl` files, most notably for integration with linters like stylelint.
npm install postcss-stylVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `postcss-styl` to parse Stylus code and apply PostCSS transformations, specifically using `autoprefixer`.
Refer to the GitHub issues and changelog for known limitations or recent fixes before relying on it for critical production workflows without thorough testing.
Update any direct GitHub links to `https://github.com/stylus/postcss-styl`.
Always update to the latest patch release (e.g., `0.12.3`) to benefit from the most recent bug fixes. Thoroughly test with your specific Stylus syntax, especially with comments, nesting, and complex expressions.
Set `customSyntax: 'postcss-styl'` as a string in your configuration files; PostCSS/stylelint handle the resolution.
Ensure `postcss-styl` is installed as a `devDependency` (`npm install -D postcss-styl` or `yarn add -D postcss-styl`) and is accessible from where stylelint is run.
Use `const postcssStyl = require('postcss-styl');` for Node.js scripts unless your environment explicitly supports ESM.