![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
postcss-variables-prefixer
Advanced tools
PostCSS plugin to add a prefix to all css custom properties.
Install postcss
, postcss-cli
and postcss-variables-prefixer
on your project directory:
npm install postcss postcss-cli postcss-variables-prefixer --save-dev
and in your package.json
"scripts": {
"postcss": "postcss input.css -u postcss-variables-prefixer -o output.css"
}
postcss([ require('postcss-variables-prefixer')({ /* options */ }) ])
Type: string
Default: none
String to be used as prefix
Type: array
Default: []
Array of css custom properties to be ignored by the plugin, accepts string and regex.
Example of usage with results generated by the plugin.
const postcss = require('postcss');
const prefixer = require('postcss-variables-prefixer');
const input = fs.readFileSync('path/to/file.css', 'utf-8');
const output = postcss([
prefixer({
prefix: 'prefix-',
ignore: [ /bar/, '--ignore' ]
})
]).process(input);
:root {
--foo: red;
--foo-bar: green;
--ignore: 300px;
--not-ignored: 100px;
--bar: yellow;
}
div {
background-color: var(--foo);
color: var(--foo-bar);
width: var(--ignore);
height: var(--not-ignored);
border-color: var(--bar)
}
:root {
--prefix-foo: red;
--foo-bar: green;
--ignore: 300px;
--prefix-not-ignored: 100px;
--bar: yellow;
}
div {
background-color: var(--prefix-foo);
color: var(--foo-bar);
width: var(--ignore);
height: var(--prefix-not-ignored);
border-color: var(--bar)
}
Plugin inspired by postcss-prefixer created by marceloucker.
Thanks to Andrey Sitnik @ai and Jonathan Neal @jonathantneal for the help.
FAQs
postcss plugin to prefix all css custom properties
The npm package postcss-variables-prefixer receives a total of 336 weekly downloads. As such, postcss-variables-prefixer popularity was classified as not popular.
We found that postcss-variables-prefixer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.