Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

Lightning CSS

Shrink CSS and make it work in older browsers.

Styling and CSSNPM

GitHubWebsite

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/LICENSE

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

68 / 100
Gid Score, #517 overall
261M
downloads a week, npm
7,732
GitHub stars
20
agent projects use it
Lightning CSS: downloads per weeknpm, lightningcss 260,847,791
Lightning CSS: GitHub starsparcel-bundler/lightningcss 7,732

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

13 projects, 0.4%
13 projects, 0.4%
7 projects, 0.3%

Often used with

In 75.0% of its projects
In 35.0% of its projects
In 30.0% of its projects
In 45.0% of its projects
In 80.0% of its projects
In 60.0% of its projects
In 45.0% of its projects
In 25.0% of its projects

More about Lightning CSS

Funding
  • Open Collective: https://opencollective.com/parcel

See all

More in Styling and CSS

Alternatives

Lightning CSS This page

MPL-2.0Gid 68261M/wk

cssnano

Pick cssnano when your project already runs PostCSS and you only want minifying as one more plugin there.

postcss-preset-env

Pick postcss-preset-env when you need to keep a PostCSS plugin setup and only want new CSS syntax made compatible.

esbuild

Pick esbuild when you bundle JavaScript too and want one tool that also minifies the CSS.

Sass

CSS preprocessor adding variables, nesting and mixins to stylesheets.

MITGid 7144.8M/wk

sass-embedded

Node.js library communicating with Embedded Dart Sass via Embedded Sass protocol.

MITGid 5111.4M/wk

Compare Lightning CSS with another tool

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%')).”

  1. Install it in your project as a build-time package.

    npm install --save-dev lightningcss

    From lightningcss.dev/docs.html

  2. Call 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
    });
    

    From lightningcss.dev/docs.html

  3. Pass browser targets, or nothing is rewritten for older browsers.

    From lightningcss.dev/transpilation.html

Mistakes to avoid

transform({ filename, code, minify: true }) and expecting nesting or oklch() to be rewritten
Add targets, e.g. targets = browserslistToTargets(browserslist('>= 0.25%')), or --targets on the command line

Without targets nothing is lowered; in our run the output without --targets still had & nesting and oklch().

targets: { safari: 13 } or targets: ['safari 13']
Use browserslistToTargets(...), or encode versions like { safari: (13 << 16) | (2 << 8) }

The targets object stores each browser version as one packed number, not a plain version.

code: '.foo { color: red }' (a plain string) in transform()
code: Buffer.from(css) in Node, or new TextEncoder().encode(css) with lightningcss-wasm

transform reads bytes, not strings.

Calling bundle() from lightningcss-wasm in the browser
Use transform() in the browser and run bundling in Node or the command line

The WebAssembly build has no bundle or visitor functions.

Checking the installed version with lightningcss --version
Check the version in package.json or package-lock.json

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.