1. License
“You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software.”
Use it in any build; your CSS and the output stay yours.
github.com/parcel-bundler/lightningcss/blob/master/LICENSE3. Used by agents' projects
Dependency in 20 public GitHub projects set up for AI coding agents that we scanned (0.3%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily; card checked Nov 11, 2026. Tap a verdict to see its source.How we checkedReport an error
What Lightning CSS does
Lightning CSS is a free build tool that reads your site's CSS and writes a smaller, safer copy. You can write new CSS features such as nesting or modern colors, name the oldest browsers you support, and it rewrites what they would not understand. It also adds browser prefixes, joins several CSS files into one and minifies the result.
What people build with it
Smaller CSS for a faster site
Before you publish, squeeze the stylesheet so visitors download fewer bytes; colors, shorthands and repeated rules get shorter.
New CSS that older browsers still show
Your AI assistant writes CSS with nesting and oklch() colors; Lightning CSS rewrites it for the oldest Safari or Chrome your visitors use.
Faster CSS step in a Vite project
Let Vite use Lightning CSS for processing and minifying the CSS of your React or Vue site.
One file from many imports
Your styles are split into parts that import each other; ship them as one file so the page makes fewer requests.
Class names that never clash
Two parts of the site both use a class called .title; scoped names keep their styles from overwriting each other.
Replace a chain of CSS plugins Idea
An older project runs several PostCSS plugins for prefixes and new syntax; one Lightning CSS step can take their place.
Lightning CSS popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How Lightning CSS is used
- Lightning CSS is a dependency in 20 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (0.4% of the 4,867 JavaScript/TypeScript ones), #9 of 53 in styling and css.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 57; those are left out of every share on this page.
- The most used alternative in our scan is Sass (109 projects).
- Projects that use it most often also use ESLint (75.0%), tw-animate-css (35.0%), react-markdown (30.0%).
By coding agent
Often used with
More about Lightning CSS
Funding
- Open Collective: https://opencollective.com/parcel
Alternatives
Lightning CSS This page
Pick cssnano when your project already runs PostCSS and you only want minifying as one more plugin there.
Pick postcss-preset-env when you need to keep a PostCSS plugin setup and only want new CSS syntax made compatible.
Pick esbuild when you bundle JavaScript too and want one tool that also minifies the CSS.
CSS preprocessor adding variables, nesting and mixins to stylesheets.
Node.js library communicating with Embedded Dart Sass via Embedded Sass protocol.
Get started
Tell your AI assistant
“Add lightningcss@1.33.0 as a dev dependency and use it as the CSS transformer and minifier in vite.config.ts, with targets from browserslistToTargets(browserslist('>= 0.25%')).”
Install it in your project as a build-time package.
npm install --save-dev lightningcssCall transform with the file name and the CSS as a Buffer.
import { transform } from 'lightningcss'; let { code, map } = transform({ filename: 'style.css', code: Buffer.from('.foo { color: red }'), minify: true, sourceMap: true });Pass browser targets, or nothing is rewritten for older browsers.
Mistakes to avoid
Without targets nothing is lowered; in our run the output without --targets still had & nesting and oklch().
The targets object stores each browser version as one packed number, not a plain version.
transform reads bytes, not strings.
The WebAssembly build has no bundle or visitor functions.
In our run the 1.33.0 binary printed "lightningcss 1.0.0-alpha.72", an old internal number.
Questions
Can it run in the browser?
Yes, through the lightningcss-wasm package, but without the bundle and plugin features.
Does Vite support it?
Yes. Set it as the CSS transformer and minifier in the Vite config.
How do I say which browsers to support?
Give a browserslist query to --targets on the command line, or use browserslistToTargets in code.
Is there a command-line version?
Yes, the lightningcss-cli package compiles, minifies and bundles CSS files without other build tools.