Lightning CSS Processor
lightningcss.dev
1
Leaving SiteNav
External Link Disclaimer
You are about to visit lightningcss.dev. This website is not operated by us. We are not responsible for its content or privacy practices.
About this website
Lightning CSS is a CSS parser, transformer, bundler, and minifier written in Rust that processes stylesheets over one hundred times faster than JavaScript-based alternatives on comparable workloads. Benchmarks show it minifying Bootstrap CSS in approximately four milliseconds compared to seventeen milliseconds for esbuild and over five hundred milliseconds for cssnano, while producing smaller output through aggressive optimization passes. The tool fully parses every CSS rule, property, and value using the same cssparser and selectors crates that power the Firefox rendering engine, ensuring browser-grade correctness in syntax handling. Transformation features let developers write modern CSS syntax and have it automatically downcompiled for target browsers: CSS nesting is unrolled into descendant selectors, custom media queries are resolved, the oklab and oklch color functions are converted to rgb fallbacks with display-p3 progressive enhancement, logical properties are mapped to physical equivalents, and vendor prefixes are added automatically based on configurable browser targets. The minifier combines longhand properties into shorthands, merges adjacent compatible rules, removes default values, reduces calc expressions, shortens colors, and optimizes gradient syntax. CSS modules support generates locally scoped class names, preventing style collisions, and produces a JSON mapping of original to transformed names that build tools can consume for tree-shaking unused styles. The library exposes a JavaScript API through native bindings, a Rust crate, and a WebAssembly build for browser usage. Integration is provided for Parcel, Vite, Webpack, Rollup, PostCSS, and Node.js scripts, with the Parcel bundler using it as its default CSS processor. Custom transforms can be written in Rust to extend or override the built-in transformation pipeline.
Statistics
1
Views
0
Clicks
0
Like
0
Dislike