github parcel-bundler/lightningcss v1.14.0

latest releases: v1.27.0, v2.26.0, v1.26.0...
2 years ago

We are excited to announce that Parcel CSS is now called Lightning CSS! ⚡ This new name makes it clear that the project can be used outside of Parcel, with other build tools, or even standalone.

We also have a brand new website showcasing some of the features, along with the WASM-based playground at lightningcss.dev. This will expand over time to include more documentation and examples.

Going forward, new releases will be under the lightningcss npm package and Rust crate. The @parcel/css package still exists on npm for backward compatibility, but now re-exports lightningcss. The parcel_css Rust crate is deprecated - please use lightningcss going forward.

New features

This release also includes several new features, including major improvements to the bundler.

Custom JS resolver

The node bindings now include a new bundleAsync function in addition to the existing bundle function. bundleAsync runs the bundler asynchronously in a background thread, and returns a promise that lets you know when it has completed. In addition, bundleAsync supports custom JavaScript-based resolvers, which allow you to customize the resolution behavior for @import specifiers, and provide the contents of files from a source other than the file system.

let {code, map} = await css.bundleAsync({
  filename: 'style.css',
  minify: true,
  resolver: {
    read(filePath) {
      return fs.readFileSync(filePath, 'utf8');
    },
    resolve(specifier, from) {
      return path.resolve(path.dirname(from), specifier);
    }
  }
});

Note that providing a resolver can negatively affect performance, so only do so when you need to customize things.

CSS modules bundling

Dependencies in CSS modules are now also bundled. For example, the composes property allows you to reference another file. These will now be bundled, and the resolved class name will be included in the output JSON as well.

Bug fixes

  • add types for wasm init default export – @deckchairlabs in #269
  • match the spec so that feature-* in @font-face tech() becomes plural – @yisibl in #270
  • CSS-wide keywords and none in @keyframes cannot remove quotes – @yisibl in #267

Don't miss a new lightningcss release

NewReleases is sending notifications on new releases.