lightningcss
1.33.0 · 20 Jul 2026MPL-2.0259.9M / weekRepositoryHomepagenpmAtom feed
1.33.0 is the newest release of 1.x.
In short
9 new14 fixed
Release note
This release includes several features and improvements for the custom visitor API, including support for defining how to parse custom at rules. In addition, lots of bug fixes are included for auto prefixing, selector downleveling, and more.
Custom at-rules
When Lightning CSS does not know how to parse an unknown at rule, it stores the prelude and body as a list of raw tokens. Without a definition for how a rule should be parsed, Lighting CSS doesn't know how to interpret it. Tokens are fine for simple use cases, but if you are building a custom visitor plugin that processes a custom at-rule, and want it to integrate with the rest of CSS, it is useful to define how the rule should be parsed and interpreted. In this release, a new customAtRules option has been added to the API to enable just that.
For example, here is how you could define an @mixin rule which expects a custom identifier as its prelude, and a style-block as its body. This allows nesting declarations and rules just like other at-rules like @media and @supports.
{
customAtRules: {
mixin: {
prelude: '<custom-ident>',
body: 'style-block'
}
}
}With that, you can parse code like this:
@mixin foo {
color: red;
&.bar {
color: green;
}
}Lightning CSS also validates the code and will emit syntax errors when it doesn't conform to the syntax definition. Another nice part is that we use this definition to automatically infer the TypeScript types for these rules when used in custom visitors.
Check out the documentation to learn more!
Features
Implement support for parsing custom at rules in JS bindings
Support
rawproperty on returned declarations in visitorsSupport
rawvalues in visitors that return tokensMake more AST properties optional in visitor return types
Add
substitute_variablesfunction toUnparsedPropertyin the Rust APIAdd
Implement Property::set_prefixfunctionMerge non-adjacent
@layerrulesShort-circuit on error in Rust visitor API
Support nesting selector at the root, which is transformed to
:scope
Fixes
<layer-name>should be escapedWASM: Only use import.meta.url in fallback scenario
Publish docs for optional features on docs.rs
Support node in wasm package
Fix parsing oblique angles in font-style descriptor
Update autoprefixer data for text-decoration
Bump mdn compat data
Fix downleveling selectors in
:is,:where, and:hasFix serializing
:hostand::slottedselectorsCopy license into all npm packages
Improve deserialization error messages for custom visitors
Fix cue-region-function ast types
Fix serializing
currentColorUse unpkg module option in docs for wasm
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.