
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
postcss-styl
Advanced tools
PostCSS parser plugin for converting Stylus syntax to PostCSS AST.
::: This plugin is still in an experimental state :::
npm install -D postcss-styl
You can use this PostCSS plugin to apply Stylus syntax to stylelint.
You can use it more easily by using it with stylelint-plugin-stylus.
For example, this PostCSS plugin is used as follows:
First, add customSyntax option to stylelint config file.
e.g. stylelint.config.js
// Filename: `stylelint.config.js`
module.exports = {
   overrides: [
       {
           files: ["*.styl", "**/*.styl", "*.stylus", "**/*.stylus"],
           customSyntax: "postcss-styl",
       },
   ],
};
You need to include the stylus in the linting target, as shown in the following example.
via CLI
stylelint ./path/to/input.styl
with VSCode extension
{
  "stylelint.validate": [
     ...,
     // ↓ Add "stylus" language.
     "stylus"
  ]
}
Also you can use this parser plugin to apply PostCSS transformations directly to the Stylus source code.
For example, Stylus sources can be automatically prefixed using Autoprefixer.
const postcss = require("postcss");
const autoprefixer = require("autoprefixer");
const postcssStyl = require("postcss-styl");
const stylusCode = `
a
  transform scale(0.5)
`;
postcss([autoprefixer])
  .process(stylusCode, {
    syntax: postcssStyl
  })
  .then(result => {
    console.log(result.css);
    // ->
    // a
    //   -webkit-transform scale(0.5);
    //   -moz-transform scale(0.5);
    //   transform scale(0.5)
  });
Welcome contributing!
Please use GitHub's Issues/PRs.
npm test runs tests and measures coverage.You can check the AST online.
https://stylus.github.io/postcss-styl/
See the LICENSE file for license rights and limitations (MIT).
FAQs
PostCSS parser plugin for converting Stylus syntax to PostCSS AST.
We found that postcss-styl demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.