Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(css/minifier) Follow the CSS spec more rigorously #6291

Merged
merged 2 commits into from Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1,881 changes: 1,059 additions & 822 deletions crates/swc_css_minifier/src/compressor/calc_sum.rs

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion crates/swc_css_minifier/src/compressor/mod.rs
Expand Up @@ -25,7 +25,6 @@ mod supports;
mod time;
mod transform_function;
mod unicode_range;
mod unit;
mod url;

pub fn compressor() -> impl VisitMut {
Expand Down
122 changes: 0 additions & 122 deletions crates/swc_css_minifier/src/compressor/unit/mod.rs

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -1 +1 @@
@container(inline-size>=200px){h2{font-size:calc(1.2em + 1cqi)}}
@container(inline-size>=200px){h2{font-size:calc(1cqi + 1.2em)}}
Expand Up @@ -85,3 +85,113 @@
.class22 {
width: calc(1px + 2unknown);
}

.class23 {
width: calc(1hz + 1khz);
}

.class24 {
width: calc(1khz + 1hz);
}

.class25 {
width: calc(1ms + 1s);
}

.class26 {
width: calc(1ms + 1s);
}

.class27 {
width: calc(1dppx + 1x);
}

.class28 {
width: calc(1x + 1dppx);
}

.class29 {
width: calc(1x + 96dpi);
}

.class30 {
width: calc(96dpi + 1x);
}

.class31 {
width: calc(1dppx + 96dpi);
}

.class32 {
width: calc(96dpi + 1dppx);
}

.class33 {
width: calc(1dpcm + 1dpi);
}

.class34 {
width: calc(1dpcm + 1dpi);
}

.class35 {
width: calc(1cm + 1mm);
}

.class36 {
width: calc(1mm + 1cm);
}

.class37 {
width: calc(1mm + 1q);
}

.class38 {
width: calc(1q + 1mm);
}

.class39 {
width: calc(1cm + 1q);
}

.class40 {
width: calc(1q + 1cm);
}

.class39 {
width: calc(1in + 1px);
}

.class40 {
width: calc(1px + 1in);
}

.class41 {
width: calc(1pc + 1in);
}

.class42 {
width: calc(1in + 1pc);
}

.class43 {
width: calc(1pt + 1in);
}

.class44 {
width: calc(1in + 1pt);
}

.class45 {
width: calc(1pt + 1pc);
}

.class46 {
width: calc(1pc + 1pt);
}
.class47 {
width: calc(1px + 1pc);
}
.class48 {
width: calc(1pc + 1px);
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -1 +1 @@
.class1{width:calc(((var(--a) + 4px)*2)*2)}.class2{width:calc(((var(--a) + 4px)*2)*2 + 4px)}
.class1{width:calc(4*(4px + var(--a)))}.class2{width:calc(4px + 4*(4px + var(--a)))}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -1 +1 @@
.class1{width:calc(1/100)}.class2{width:calc(5/1e6)}.class3{width:calc(100%/3*3)}.class4{width:calc(calc(100%/3)*3)}
.class1{width:.01}.class2{width:calc(5*1e-6)}.class3,.class4{width:100%}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -1 +1 @@
.class1,.class2{width:2px}.class3{width:-webkit-calc(50% - 25px)}.class4{width:-webkit-calc(1px + 2px/2)}.class5,.class6{width:2px}
.class1,.class2{width:2px}.class3{width:-webkit-calc(50% - 25px)}.class4,.class5,.class6{width:2px}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.