
- #PARCEL VIEWR FULL#
- #PARCEL VIEWR SERIES#
Use readFileSync rather than readFile if possible for better performance, or omit either of the methods if you don't need to override the default behavior. Note that using a custom resolver can slow down bundling significantly, especially when reading files asynchronously. Here is a simple example that compiles the input CSS for Safari 13.2, and minifies the output.
#PARCEL VIEWR FULL#
See the TypeScript definitions for full API docs. Lightning CSS can be used from Parcel, as a standalone library from JavaScript or Rust, using a standalone CLI, or wrapped as a plugin within any other tool.
Opt-in support for locally scoped CSS variables and other dashed identifiers. Locally scoped custom identifiers, e.g. CSS modules – Lightning CSS supports compiling a subset of CSS modules features. clamp(), round(), rem(), and mod() math functions. Space separated components in rgb and hsl functions. color() function supporting predefined color spaces such as display-p3 and xyz. lab(), lch(), oklab(), and oklch() colors. Syntax lowering – Lightning CSS parses modern CSS syntax, and generates more compatible output where needed, based on browser targets. Vendor prefixing – Lightning CSS accepts a list of browser targets, and automatically adds (and removes) vendor prefixes. converting to shorter units, removing unnecessary quotation marks, etc. Removing default property sub-values which will be inferred by browsers. Converting colors to shorter hex notation where possible. Reducing calc() expressions where possible. Removing vendor prefixes that are not needed, based on the provided browser targets. Combining CSS transforms into a single matrix or vice versa when smaller. Merging adjacent rules with the same selectors or declarations when it is safe to do so. Combining longhand properties into shorthands where possible. This includes many optimizations including: Minification – One of the main purposes of Lightning CSS is to minify CSS to make it smaller. These provide a solid general purpose CSS-parsing foundation on top of which Lightning CSS implements support for all specific CSS rules and properties. Browser-grade parser – Lightning CSS is built on the cssparser and selectors crates created by Mozilla and used by Firefox and Servo. Lightning CSS parses all values using the grammar from the CSS specification, and exposes a specific value type for each property. This means that each transformer that wants to do something with these values must interpret them itself, leading to duplicate work and inconsistencies. #PARCEL VIEWR SERIES#
Typed property values – many other CSS parsers treat property values as an untyped series of tokens.Extremely fast – Parsing and minifying large files is completed in milliseconds, often with significantly smaller output than other tools.Use it with Parcel, as a standalone library or CLI, or via a plugin with any other tool. An extremely fast CSS parser, transformer, and minifier written in Rust.