{
 "kind": "tool",
 "slug": "lightningcss",
 "path": "tools/lightningcss/",
 "name": "Lightning CSS",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Styling and CSS",
   "tools/styling/"
  ]
 ],
 "lead": "Shrink CSS and make it work in older browsers.",
 "chips": [
  {
   "label": "Styling and CSS",
   "path": "tools/styling/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install lightningcss"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/parcel-bundler/lightningcss"
  },
  {
   "label": "Website",
   "href": "https://github.com/parcel-bundler/lightningcss#readme"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MPL-2.0",
   "status": "cond",
   "sub": "Share changes to the library",
   "quote": "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.",
   "note": "Use it in any build; your CSS and the output stay yours.",
   "src": "https://github.com/parcel-bundler/lightningcss/blob/master/LICENSE"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 24, 2026",
   "note": "Latest GitHub release Jul 20, 2026. ",
   "src": "https://github.com/parcel-bundler/lightningcss"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "20 projects",
   "status": "info",
   "sub": "#9 of 53 in its category",
   "note": "Dependency in 20 public GitHub projects set up for AI coding agents that we scanned (0.3%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Install only",
   "status": "info",
   "sub": null,
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": null
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily; card checked Nov 11, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What Lightning CSS does",
   "parts": [
    {
     "t": "prose",
     "text": "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."
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Smaller CSS for a faster site",
       "text": "Before you publish, squeeze the stylesheet so visitors download fewer bytes; colors, shorthands and repeated rules get shorter.",
       "idea": false
      },
      {
       "title": "New CSS that older browsers still show",
       "text": "Your AI assistant writes CSS with nesting and oklch() colors; Lightning CSS rewrites it for the oldest Safari or Chrome your visitors use.",
       "idea": false
      },
      {
       "title": "Faster CSS step in a Vite project",
       "text": "Let Vite use Lightning CSS for processing and minifying the CSS of your React or Vue site.",
       "idea": false
      },
      {
       "title": "One file from many imports",
       "text": "Your styles are split into parts that import each other; ship them as one file so the page makes fewer requests.",
       "idea": false
      },
      {
       "title": "Class names that never clash",
       "text": "Two parts of the site both use a class called .title; scoped names keep their styles from overwriting each other.",
       "idea": false
      },
      {
       "title": "Replace a chain of CSS plugins",
       "text": "An older project runs several PostCSS plugins for prefixes and new syntax; one Lightning CSS step can take their place.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "Lightning CSS popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "68",
       "of": "/ 100",
       "l": "Gid Score, #517 overall"
      },
      {
       "n": "261M",
       "l": "downloads a week, npm"
      },
      {
       "n": "7,732",
       "l": "GitHub stars"
      },
      {
       "n": "20",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How Lightning CSS is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "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%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "13 projects, 0.4%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "13 projects, 0.4%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "7 projects, 0.3%",
       "v": "Cursor",
       "path": "agents/cursor/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 75.0% of its projects",
       "v": "ESLint",
       "path": "tools/eslint/"
      },
      {
       "l": "In 35.0% of its projects",
       "v": "tw-animate-css",
       "path": "tools/tw-animate-css/"
      },
      {
       "l": "In 30.0% of its projects",
       "v": "react-markdown",
       "path": "tools/react-markdown/"
      },
      {
       "l": "In 45.0% of its projects",
       "v": "Playwright (JavaScript)",
       "path": "tools/playwright-test/"
      },
      {
       "l": "In 80.0% of its projects",
       "v": "TypeScript",
       "path": "tools/typescript/"
      },
      {
       "l": "In 60.0% of its projects",
       "v": "Tailwind CSS",
       "path": "tools/tailwindcss/"
      },
      {
       "l": "In 45.0% of its projects",
       "v": "Vite",
       "path": "tools/vite/"
      },
      {
       "l": "In 25.0% of its projects",
       "v": "Zustand",
       "path": "tools/zustand/"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "usage",
   "h2": "More about Lightning CSS",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "Open Collective: https://opencollective.com/parcel"
       ]
      },
      {
       "title": "More in Styling and CSS",
       "path": "tools/styling/",
       "items": [
        {
         "text": "Tailwind CSS",
         "path": "tools/tailwindcss/"
        },
        {
         "text": "Tailwind Merge",
         "path": "tools/tailwind-merge/"
        },
        {
         "text": "Emotion",
         "path": "tools/emotion/"
        },
        {
         "text": "tailwind-variants",
         "path": "tools/tailwind-variants/"
        },
        {
         "text": "Fontsource Inter",
         "path": "tools/fontsource-variable-inter/"
        },
        {
         "text": "NativeWind",
         "path": "tools/nativewind/"
        },
        {
         "text": "postcss-import",
         "path": "tools/postcss-import/"
        },
        {
         "text": "mode-watcher",
         "path": "tools/mode-watcher/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "Lightning CSS",
       "me": true,
       "facts": [
        "MPL-2.0",
        "Gid 68",
        "261M/wk"
       ]
      },
      {
       "name": "cssnano",
       "why": "Pick cssnano when your project already runs PostCSS and you only want minifying as one more plugin there.",
       "path": "tools/cssnano/",
       "facts": []
      },
      {
       "name": "postcss-preset-env",
       "why": "Pick postcss-preset-env when you need to keep a PostCSS plugin setup and only want new CSS syntax made compatible.",
       "path": "tools/postcss-preset-env/",
       "facts": []
      },
      {
       "name": "esbuild",
       "why": "Pick esbuild when you bundle JavaScript too and want one tool that also minifies the CSS.",
       "path": "tools/esbuild/",
       "facts": []
      },
      {
       "name": "Sass",
       "why": "CSS preprocessor adding variables, nesting and mixins to stylesheets.",
       "path": "tools/sass/",
       "facts": [
        "MIT",
        "Gid 71",
        "44.8M/wk"
       ]
      },
      {
       "name": "sass-embedded",
       "why": "Node.js library communicating with Embedded Dart Sass via Embedded Sass protocol.",
       "path": "tools/sass-embedded/",
       "facts": [
        "MIT",
        "Gid 51",
        "11.4M/wk"
       ]
      }
     ],
     "more": "Compare Lightning CSS with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "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%'))."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Install it in your project as a build-time package.",
       "code": "npm install --save-dev lightningcss",
       "src": "https://lightningcss.dev/docs.html"
      },
      {
       "text": "Call transform with the file name and the CSS as a Buffer.",
       "code": "import { transform } from 'lightningcss';\n\nlet { code, map } = transform({\n  filename: 'style.css',\n  code: Buffer.from('.foo { color: red }'),\n  minify: true,\n  sourceMap: true\n});\n",
       "src": "https://lightningcss.dev/docs.html"
      },
      {
       "text": "Pass browser targets, or nothing is rewritten for older browsers.",
       "code": null,
       "src": "https://lightningcss.dev/transpilation.html"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "transform({ filename, code, minify: true }) and expecting nesting or oklch() to be rewritten",
       "fix": "Add targets, e.g. targets = browserslistToTargets(browserslist('>= 0.25%')), or --targets on the command line",
       "why": "Without targets nothing is lowered; in our run the output without --targets still had & nesting and oklch()."
      },
      {
       "dont": "targets: { safari: 13 } or targets: ['safari 13']",
       "fix": "Use browserslistToTargets(...), or encode versions like { safari: (13 << 16) | (2 << 8) }",
       "why": "The targets object stores each browser version as one packed number, not a plain version."
      },
      {
       "dont": "code: '.foo { color: red }' (a plain string) in transform()",
       "fix": "code: Buffer.from(css) in Node, or new TextEncoder().encode(css) with lightningcss-wasm",
       "why": "transform reads bytes, not strings."
      },
      {
       "dont": "Calling bundle() from lightningcss-wasm in the browser",
       "fix": "Use transform() in the browser and run bundling in Node or the command line",
       "why": "The WebAssembly build has no bundle or visitor functions."
      },
      {
       "dont": "Checking the installed version with lightningcss --version",
       "fix": "Check the version in package.json or package-lock.json",
       "why": "In our run the 1.33.0 binary printed \"lightningcss 1.0.0-alpha.72\", an old internal number."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Can it run in the browser?",
       "a": "Yes, through the lightningcss-wasm package, but without the bundle and plugin features.",
       "evidence": {
        "url": "https://lightningcss.dev/docs.html",
        "quote": "The lightningcss-wasm package can be used in Deno or directly in browsers."
       }
      },
      {
       "q": "Does Vite support it?",
       "a": "Yes. Set it as the CSS transformer and minifier in the Vite config.",
       "evidence": {
        "url": "https://lightningcss.dev/docs.html",
        "quote": "Vite supports Lightning CSS out of the box."
       }
      },
      {
       "q": "How do I say which browsers to support?",
       "a": "Give a browserslist query to --targets on the command line, or use browserslistToTargets in code.",
       "evidence": {
        "url": "https://lightningcss.dev/transpilation.html",
        "quote": "CLI When using the CLI, targets can be provided by passing a browserslist query to the --targets option."
       }
      },
      {
       "q": "Is there a command-line version?",
       "a": "Yes, the lightningcss-cli package compiles, minifies and bundles CSS files without other build tools.",
       "evidence": {
        "url": "https://lightningcss.dev/docs.html",
        "quote": "Lightning CSS includes a standalone CLI that can be used to compile, minify, and bundle CSS files."
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm lightningcss"
  ],
  [
   "Category",
   "Styling and CSS"
  ],
  [
   "License",
   "MPL-2.0"
  ],
  [
   "Gid Score",
   "67.5"
  ],
  [
   "Rank in category",
   "#9 of 53"
  ],
  [
   "GitHub",
   "parcel-bundler/lightningcss"
  ],
  [
   "Last change",
   "Nov 24, 2026"
  ]
 ],
 "good": [
  "Without browser targets it only cleans up and minifies; nothing is rewritten for older browsers.",
  "It is strict by default and stops at broken rules; a recovery switch skips them with a warning instead.",
  "The browser build cannot join imported files or run custom plugins."
 ],
 "checked_line": "Read by AgentGid from 10 official pages, card checked Nov 11, 2026; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/parcel-bundler.png"
}