Crate lightningcss

Source
Expand description

Lightning CSS is a CSS parser, transformer, and minifier based on the cssparser crate used in Firefox. It supports fully parsing all CSS rules, properties, and values into normalized structures exactly how a browser would. Once parsed, the CSS can be transformed to add or remove vendor prefixes, or lower syntax for older browsers as appropriate. The style sheet can also be minified to merge longhand properties into shorthands, merge adjacent rules, reduce calc() expressions, and more. Finally, the style sheet can be printed back to CSS syntax, either minified to remove whitespace and compress the output as much as possible, or pretty printed.

The StyleSheet struct is the main entrypoint for Lightning CSS, and supports parsing and transforming entire CSS files. You can also parse and manipulate individual CSS rules, properties, or values. The bundler module also can be used to combine a CSS file and all of its dependencies together into a single style sheet. See the individual module documentation for more details and examples.

Modules§

bundlerbundler
CSS bundling.
css_modules
CSS module exports.
declaration
CSS declarations.
dependencies
Dependency analysis.
error
Error types.
media_query
Media queries.
printer
CSS serialization and source map generation.
properties
CSS property values.
rules
CSS rules.
selector
CSS selectors.
stylesheet
CSS style sheets and style attributes.
targets
Browser target options.
traits
Traits for parsing and serializing CSS.
values
Common CSS values used across many properties.
vendor_prefix
Vendor prefixes.
visitorvisitor
Visitors for traversing the values in a StyleSheet.

Macros§

visit_typesvisitor
Constructs a constant VisitTypes from flags.