
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
postcss-easy-z
Advanced tools
PostCSS plugin to organize z-indices by declaring relations between them.
z-stackYou can stack your CSS variables for z-indices with z-stack. Each new variable will be positioned over the previous:
:root {
--z-body: z-stack();
--z-header: z-stack();
--z-popup: z-stack();
}
/* Output */
:root {
--z-body: 1;
--z-header: calc(var(--z-body) + 1);
--z-popup: calc(var(--z-header) + 1);
}
You can provide starting value for the stack:
:root {
--z-body: z-stack(10);
--z-header: z-stack();
}
/* Output */
:root {
--z-body: 10;
--z-header: calc(var(--z-body) + 1);
}
Stack is isolated by selector:
.a {
--z-a1: z-stack();
--z-a2: z-stack();
}
.b {
--z-b1: z-stack();
--z-b2: z-stack();
}
/* Output */
.a {
--z-a1: 1;
--z-a2: calc(var(--z-a1) + 1);
}
.b {
--z-b1: 1;
--z-b2: calc(var(--z-b1) + 1);
}
z-over and z-underYou can explicitly describe relations between z-indices with z-over and z-under:
.overBody {
z-index: z-over(var(--z-body));
}
.underHeader {
z-index: z-under(var(--z-header));
}
/* Output */
.overBody {
z-index: calc(var(--z-body) + 1);
}
.underHeader {
z-index: calc(var(--z-header) - 1);
}
Step 1: Install plugin:
npm install --save-dev postcss postcss-easy-z
Step 2: Check you project for existed PostCSS config: postcss.config.js
in the project root, "postcss" section in package.json
or postcss in bundle config.
If you do not use PostCSS, add it according to official docs and set this plugin in settings.
Step 3: Add the plugin to plugins list:
module.exports = {
plugins: [
+ require('postcss-easy-z'),
require('autoprefixer')
]
}
To enforce usage of variables for z-index property add stylelint-declaration-strict-value to stylelint config:
module.exports = {
plugins: ['stylelint-declaration-strict-value'],
rules: {
'scale-unlimited/declaration-strict-value': [
'z-index',
{
ignoreValues: ['initial', -1, 0, 1],
},
],
},
}
FAQs
PostCSS plugin to organize z-indices
We found that postcss-easy-z 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
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.