
Research
Security News
The Landscape of Malicious Open Source Packages: 2025 Mid‑Year Threat Report
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
postcss-lightningcss
Advanced tools
This PostCSS plugin uses lightningcss to compile and minify your CSS.
lightningcss
is more than a minifier as it can replace quite a few PostCSS plugins such as autoprefixer
.
You can find the complete list of features in the package's documentation and the list of plugins it's able to replace below.
yarn add -D postcss-lightningcss
const postcss = require("postcss");
const postcssLightningcss = require("postcss-lightningcss");
postcss([postcssLightningcss(/* pluginOptions */)]).process(
YOUR_CSS /*, processOptions */
);
const postcssLightningcss = require("postcss-lightningcss");
postcssLightningcss({
// Use a browserslist query that will inform which browsers are supported
// Will add or remove vendor prefixes that are needed or not anymore
browsers: ">= .25%",
// Will pass all options to lightningcss
// Check out their documentation for details:
// https://www.npmjs.com/package/lightningcss#user-content-documentation
lightningcssOptions: {
// Enable minification (default: true)
minify: true,
// Enable source maps (default: true)
sourceMap: true,
// Compile as cssModules (default: undefined)
cssModules: false,
// For which browsers to compile (default: undefined)
// Can be omitted if you set the `browsers` option
targets: {
safari: (13 << 16) | (2 << 8), // represents Safari 13.2.0
},
// Individually enable various drafts
drafts: {
// Enable css nesting (default: undefined)
nesting: false,
},
},
});
The detailed list of lightningcssOptions
can be found here
Source maps will pass through lightningcss
.
But many mappings will be lost in translation; lightningcss
creates only a source map for selectors.
Mappings for properties cannot be re-created after this transformation.
lightningcss
The rows marked as "Depends on browser config" will convert your CSS only if:
browsers
or lightningcssOptions.targets
optionsPostCSS Plugin | lightningcss option |
---|---|
autoprefixer | Depends on browser config |
postcss-clamp | Depends on browser config |
postcss-color-hex-alpha | Depends on browser config |
postcss-color-hsl | Depends on browser config |
postcss-color-rgb | Depends on browser config |
postcss-color-function | Depends on browser config |
postcss-color-rebeccapurple | Depends on browser config |
postcss-custom-media | lightningcssOptions.drafts.customMedia |
postcss-double-position-gradients | Depends on browser config |
postcss-hwb-function | Depends on browser config |
postcss-lab-function | Depends on browser config |
postcss-logical | Depends on browser config (1) |
postcss-media-minmax | Depends on browser config |
postcss-multi-value-display | Depends on browser config |
postcss-nesting | lightningcssOptions.drafts.nesting |
postcss-normalize-display-values | Depends on browser config |
postcss-oklab-function | Depends on browser config |
postcss-overflow-shorthand | Depends on browser config |
postcss-place | Depends on browser config |
postcss-progressive-custom-properties | Depends on browser config (2) |
lightningcss
doesn't support the logical
shorthand keyword as its syntax is likely to changelab(29.2345% 39.3825 20.0664)
has a proper fallbackoklch(40% 0.234 0.39 / var(--opacity-50))
will not have a fallbackMIT
FAQs
PostCSS plugin to use lightningcss
The npm package postcss-lightningcss receives a total of 8,047 weekly downloads. As such, postcss-lightningcss popularity was classified as popular.
We found that postcss-lightningcss demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Research
Security News
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.