Skip to content

[labs/rollup-plugin-minify-html-literals] Fix @container queries drop… - #5237

Draft
Nitin75408 wants to merge 1 commit into
lit:mainfrom
Nitin75408:fixes/5207
Draft

Nitin75408 wants to merge 1 commit into
lit:mainfrom
Nitin75408:fixes/5207

Conversation

@Nitin75408

Copy link
Copy Markdown

Summary

Fixes #5207: CSS @container queries inside css\`tagged template literals are silently dropped by@lit-labs/rollup-plugin-minify-html-literals` during build.

  • Upgrade clean-css from ^4.2.1 → ^5.3.3, which natively recognises @container, @layer, and @scope at-rules
  • Remove the now-dead transform callback from adjustMinifyCSSOptions() (CleanCSS v5 removed this from its level-1 optimizer); update types/clean-css.ts accordingly
  • Fix a semicolon-preservation regression: CleanCSS v5 collapses ;; → ; when a template part begins with ; (the declaration separator between two interpolated CSS properties). The single remaining ; is consumed by splitHTMLByPlaceholder, stripping it from the output. minify-html-literals.ts now restores the leading ; for such parts, except when the part starts with } (a trailing semicolon before a closing brace that CleanCSS correctly removed)
  • Add a regression test for @container that fails on CleanCSS v4 and passes on v5

Files changed

File Change
package.json clean-css v4 → v5, @types/clean-css → ^4.2.11
src/lib/strategy.ts Remove dead transform callback; add ?. on tidySelectors
src/lib/types/clean-css.ts Omit 'transform' from OptimizationLevel.One type
src/lib/minify-html-literals.ts Restore stripped ; separator after CSS split
src/test/minify-html-literals.spec.ts Add @container regression test

@changeset-bot

changeset-bot Bot commented Feb 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4aca729

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@google-cla

google-cla Bot commented Feb 17, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[@lit-labs/rollup-plugin-minify-html-literals] Does not minify @container queries correctly

1 participant