npm / juice
juice
What changed in juice 11 to 12, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-18.
7 breaking1 security9 new APIs and options2 behavior and defaults1 tooling9 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initjuice 1224 changes
Breaking changes 7
Non-string HTML input now produces a clear
TypeError.Browserify can no longer bundle juice/client because client.js is ESM; use a modern bundler instead.
Juice is now ESM-only. Node 22.12+ can still load it through require(esm); older Node versions must upgrade or use an ESM import.
TypeScript declarations are now named index.d.ts and restructured for ESM default-export resolution.
The minimum supported Node version is now 22.12.0; Node 18 and Node 20 are no longer supported.
CSS preserved inside <style> blocks is now canonically formatted, so output may differ from previous formatting.
Specificity for :is(), :where(), :has(), and :not() now follows CSS Selectors Level 4; cascade resolution may change for styles relying on the previous behavior.
Security 1
Prevents ReDoS in CSS variable parsing, reducing the risk of denial-of-service when processing CSS.
New APIs and options 7
Adds an option to add
!importantto pseudo-classes.FreeMarker templates are supported in
codeBlocksby default.The CLI supports reading from stdin and writing to stdout.
Adds the data-juice-important attribute.
TypeScript types are exposed through the types condition in exports and resolve under nodenext module resolution.
Adds an option to preserve @container at-rules through inlining; it defaults to true.
Adds an option to preserve @layer at-rules through inlining; it defaults to true.
Tooling 1
The CLI can inline whole directories.
Fixes and other changes 8
CSS counters are resolved in document order with proper scoping.
Element lists are typed as tag name strings.
Pseudo-element rules that cannot be inlined are preserved.
Style attributes that contain invalid CSS are kept instead of causing an error.
Template tags between declarations in style attributes are preserved.
Handles
<and CDATA in style tags whenxmlModeis enabled.Level 1 nested rules, nested at-rules, parent selectors, and bare nested selectors are flattened before inlining instead of being silently dropped.
Long-standing crashes and hangs involving :not(a, b, …) are fixed.
juice 115 changes
New APIs and options 2
Adds the preservedSelectors option.
Juice can remove inlined selectors.
Behavior and default changes 2
Juice now ignores comments.
Juice can inline duplicate properties.
Fixes and other changes 1
Fixes handling of style tags with data-embed.