
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-variable-media
Advanced tools
PostCSS plugin that allows for defining custom variables to represent media queries
PostCSS plugin that allows for defining custom at-rules to represent media queries
/* before */
@tablet {
.selection {
background: #fff;
}
}
@desktop {
.selection {
background: #000;
}
}
/* after */
@media (min-width: 768px) {
.selection {
background: #fff;
}
}
@media (min-width: 1024px) {
.selection {
background: #000;
}
}
postcss([ require('postcss-variable-media') ])
See PostCSS docs for examples for your environment.
Add PostCSS to your build tool:
npm install postcss --save-dev
Load PostCSS Variables as a PostCSS plugin:
postcss([
require('postcss-variables')({ /* options */ })
]);
breakpointsType: Object
Default: {}
Specifies breakpoint variables and pixel min-width values.
require('postcss-variable-media')({
breakpoints: {
tablet: 768,
desktop: 1024
}
});
consolidateType: boolean
Default: true
Merge repeated breakpoint declarations and append to end of document. If set to false, breakpoints will be converted to media queries in place.
Note: If needing to consolidate across multiple stylesheets, refer to css-mqpacker.
require('postcss-variable-media')({
breakpoints: {
tablet: 768
},
consolidate: true
});
@tablet {
.block1 {
background: #fff;
}
}
@tablet {
.block2 {
font-size: 14px;
}
}
@media (min-width: 768px) {
.block1 {
background: #fff;
}
.block2 {
font-size: 14px;
}
}
FAQs
PostCSS plugin that allows for defining custom variables to represent media queries
The npm package postcss-variable-media receives a total of 17 weekly downloads. As such, postcss-variable-media popularity was classified as not popular.
We found that postcss-variable-media 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.