Skip to content

Fix: minifying css inside @container queries - #5205

Closed
cadamsdev wants to merge 4 commits into
lit:mainfrom
cadamsdev:fix/container-query-minification
Closed

cadamsdev wants to merge 4 commits into
lit:mainfrom
cadamsdev:fix/container-query-minification

Conversation

@cadamsdev

@cadamsdev cadamsdev commented Jan 9, 2026 •

Copy link
Copy Markdown

Fixes #5207

@changeset-bot

changeset-bot Bot commented Jan 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c893e98

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@lit-labs/rollup-plugin-minify-html-literals Patch

Not sure what this means? Click here to learn what changesets are.

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

@google-cla

google-cla Bot commented Jan 9, 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.

function cssProperty(property) {
const width = '20px';
return css\`.foo{font-size:1rem;width:\${width};color:\${property}}\`;
return css\`.foo{font-size:1rem;width:\${width}color:\${property}}\`;

@cadamsdev cadamsdev Jan 9, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regression in clean-css v5.3.3

I don't mind fixing this however...

clean-css is not maintained anymore. Can the Lit team fork clean-css and maintain it or how should we proceed?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've also seen related issues with clean-css. Modern css features like@container and native nesting are broken after being minified. I have a half-completed branch with a replacement css minify strategy, using another library, that I could move forward with, that does fix all these issues and provides greater flexibility. I wasn't sure if there was interest for an update, but it seems like yes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bencbradshaw Sounds good to me 👍

I think that would be a great update since container queries and css nesting are fully supported on all major browsers. We should be able use them. 🙂

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cadamsdev see this PR I just put up, as an alternative
#5208

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bencbradshaw Awesome thanks for doing that. I'll close this PR since I think switching to lightningcss is a better approach 😊

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

2 participants