html-minifier-terser icon indicating copy to clipboard operation
html-minifier-terser copied to clipboard

[Bug]: Nested CSS, parent is lost

Open JulianCataldo opened this issue 1 year ago • 2 comments

What happened?

CSS Nesting is now widely supported

		<style>
			html {
				&[data-is-loaded='false'] {
					opacity: 0;
				}

				&[data-is-loaded='true'] {
					transition: opacity calc(1s / 3);
					opacity: 1;
				}
			}
		</style>

Yields (unminified):

		<style>
			&[data-is-loaded='true'] {
				transition: opacity calc(1s / 3);
				opacity: 1;
			}
		</style>

Enclosing parent is lost.

Version

7.2.0

What browsers are you seeing the problem on?

No response

Link to reproduce

No response

Relevant log output

No response

Willing to submit a PR?

None

JulianCataldo avatar Jan 23 '24 17:01 JulianCataldo

Can you test, if a newer version of clesn-css supports that?

https://github.com/terser/html-minifier-terser/blob/master/package.json#L78

DanielRuf avatar Nov 02 '24 10:11 DanielRuf

Tried it with just clean-css on version 5.6.3 and it doesn't work, it looks like they're not gonna add the feature in the meanwhile: https://github.com/clean-css/clean-css/issues/1254

MacStevins avatar Dec 30 '24 17:12 MacStevins