![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
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, prepare a script that extends postcss-syntax.
e.g. custom-syntax.js
// Filename: `custom-syntax.js`
const syntax = require("postcss-syntax");
const postcssStyl = require("postcss-styl");
module.exports = syntax({
stylus: postcssStyl
});
You can use the prepared script as shown in the following example.
via CLI
stylelint ... --custom-syntax ./path/to/custom-syntax.js
use Node.js API
const stylelint = require("stylelint")
const customSyntax = require.resolve("./path/to/custom-syntax.js")
stylelint.lint({
customSyntax,
...
})
with VSCode extension
{
"stylelint.customSyntax": "${workspaceFolder}/path/to/custom-syntax.js",
"stylelint.validate": [
...,
// ↓ Add "stylus" language.
"stylus"
]
}
with PostCSS
const postcss = require("postcss")
const customSyntax = require("./path/to/custom-syntax.js")
postcss([
require("stylelint"),
require("reporter")
])
.process(css, {
from: "lib/app.styl",
syntax: customSyntax
})
})
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.See the LICENSE file for license rights and limitations (MIT).
FAQs
PostCSS parser plugin for converting Stylus syntax to PostCSS AST.
The npm package postcss-styl receives a total of 54,046 weekly downloads. As such, postcss-styl popularity was classified as popular.
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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.