Css attributes

CSS Parcel parser offered as a performance booster

Parcel CSS, a Rust-based CSS parser, compiler, and minifier, was announced this week and is positioned as a tool that offers performance and minification benefits.

Written in the Rust language, the tool handles the compilation of CSS modules as well as the tree structure and transpilation of CSS features such as nesting, logical properties and level 4 color syntax. Unveiled on January 12 by the creators of the parcel builder tool for the web, Parcel CSS can be found on GitHub. Parcel CSS can be used with Parcel or as a standalone library from JavaScript or Rust. It can also be integrated as a plug-in into other tools.

Developers can try out a live in-browser demo. According to a technology bulletin, Parcel CSS is fast not only because it was written in a native language, but also because it was designed to perform very well. The tool has memory optimizations such as representing vendor prefixes using single-byte flags and parsing CSS properties into structured data rather than representing them as strings that need to be parsed every use. Although positioned for speed, Parcel CSS doesn’t compromise on size, proponents said. It can produce smaller output than other tools in many cases because it has the ability to convert legacy CSS syntax used in many libraries to smaller, modern syntax. It also includes each individual CSS property.

Parcel CSS underpins the Rust crate cssparser, a browser-level tokenizer used in the Firefox browser. This is intended to provide a foundation that includes basic tokenization and analysis. Parcel users can try out Parcel CSS by adding the following to their .parcelrc file:

  "extends": "@parcel/config-default",
  "transformers": {
    "*.css": ["@parcel/transformer-css-experimental"]
  "optimizers": {
    "*.css": ["@parcel/optimizer-css"]

Users must also add a browserlist property to their package.json to define the target browsers for which the target CSS will be compiled.

Copyright © 2022 IDG Communications, Inc.