
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
postcss-vars
Advanced tools
Add a "not so bad" CSS custom properties support to your CSS, using PostCSS. This is not a polyfill. Native custom properties are way more powerful, due to cascade and inheritance.
Largely inspired by rework-vars.
##Install
npm install postcss-vars
##Use
Only variables defined in :root (and not in media-queries) will be used. Let's take this css:
:root {
--color-one: blue;
--color-two: green;
--color-three: var(--color-two);
}
.elem {
color: var(--color-one);
}
.item {
background: linear-gradient(var(--color-two), red);
}
@media (min-width: 50em) {
.elem {
color: var(--color-two);
}
}
Fix variables, and you will get the following output:
:root {
--color-one: blue;
--color-two: green;
--color-three: var(--color-two);
}
.elem {
color: blue;
}
.item {
background: linear-gradient(green, red);
}
@media (min-width: 50em) {
.elem {
color: green;
}
}
##API
###processor
This is the core function. Combine it with others PostCSS plugins, such as Autoprefixer:
var autoprefixer = require('autoprefixer'),
postcssVars = require('postcss-vars'),
postcss = require('postcss');
var fixed = postcss().
use(postcssVars.processor).
use(autoprefixer.postcss).
process(css).css;
###postcss
This is the full process function. Pass the css as the first argument and grab your fixed CSS.
var postcssVars = require('postcss-vars');
var fixed = postcssVars.postcss(css).css;
##License MIT
FAQs
"Not so bad" CSS custom properties' postprocessor
We found that postcss-vars 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.