Lightning CSS is an exceptionally fast CSS parser, transformer, and minifier written in Rust, primarily maintained by the Parcel team. Currently at version 1.32.0, it undergoes active development with frequent minor and patch releases, ensuring up-to-date feature support and performance improvements. Its key differentiators include leveraging Rust for unparalleled performance, a browser-grade parser (based on Mozilla's `cssparser` and `selectors` crates), and sophisticated typed property values that ensure consistent and accurate transformations across various CSS features. Beyond basic minification, it performs advanced optimizations such as combining longhand properties into shorthands, merging adjacent rules, and reducing `calc()` expressions. It also provides robust vendor prefixing based on configurable browser targets (integrating with Browserslist) and comprehensive syntax lowering for modern CSS features like CSS Nesting, Custom Media Queries, and advanced Color Level 4/5 functions, enabling developers to write modern CSS while ensuring broad browser compatibility and optimized output size.
No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
The `lightningcss` package is primarily distributed as an ESM module, though CJS is available. For modern Node.js and bundler environments, prefer ESM imports. For CJS, ensure your toolchain supports it or use dynamic import.
`bundle` is used for processing `@import` rules, which might require asynchronous operations (e.g., file system access). It can be used directly or passed to a build tool's configuration.
This utility function converts a Browserslist query into the specific target format expected by `lightningcss` functions like `transform` and `bundle`. It's essential for configuring browser compatibility.
This example demonstrates how to use `lightningcss` to parse, minify, apply vendor prefixes, and lower modern CSS syntax (like nesting, custom media, and advanced color functions) for broad browser compatibility, while generating a source map.
Breaking-change detection hasn't run for this library yet.
CVE tracking and dependency tree are planned for a later release.
No traffic data recorded yet.