You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,28 @@
14
14
console.log('size:', width +'\xD7'+ height)
15
15
```
16
16
17
+
* Lower CSS media query range syntax ([#3748](https://github.com/evanw/esbuild/issues/3748), [#4293](https://github.com/evanw/esbuild/issues/4293))
18
+
19
+
With this release, esbuild will now transform CSS media query range syntax into equivalent syntax using `min-`/`max-` prefixes for older browsers. For example, the following CSS:
20
+
21
+
```css
22
+
@media (640px <= width <= 960px) {
23
+
main {
24
+
display: flex;
25
+
}
26
+
}
27
+
```
28
+
29
+
will be transformed like thiswith a target such as `--target=chrome100` (or more specifically with`--supported:media-range=false`if desired):
30
+
31
+
```css
32
+
@media (min-width: 640px) and (max-width: 960px) {
33
+
main {
34
+
display: flex;
35
+
}
36
+
}
37
+
```
38
+
17
39
## 0.25.10
18
40
19
41
* Fix a panic in a minification edge case ([#4287](https://github.com/evanw/esbuild/issues/4287))
expectPrintedMangle(t, "@media not (1px >= width) { a { color: red } }", "@media (1px < width) {\n a {\n color: red;\n }\n}\n", "")
2626
2626
}
2627
2627
2628
+
funcTestLowerAtMediaRange(t*testing.T) {
2629
+
expectPrintedLower(t, "@media (width = 1px) { a { color: red } }", "@media (width: 1px) {\n a {\n color: red;\n }\n}\n", "")
2630
+
2631
+
expectPrintedLower(t, "@media (width < 1px) { a { color: red } }", "@media not (min-width: 1px) {\n a {\n color: red;\n }\n}\n", "")
2632
+
expectPrintedLower(t, "@media (width <= 1px) { a { color: red } }", "@media (max-width: 1px) {\n a {\n color: red;\n }\n}\n", "")
2633
+
expectPrintedLower(t, "@media (width > 1px) { a { color: red } }", "@media not (max-width: 1px) {\n a {\n color: red;\n }\n}\n", "")
2634
+
expectPrintedLower(t, "@media (width >= 1px) { a { color: red } }", "@media (min-width: 1px) {\n a {\n color: red;\n }\n}\n", "")
2635
+
2636
+
expectPrintedLower(t, "@media (1px > width) { a { color: red } }", "@media not (min-width: 1px) {\n a {\n color: red;\n }\n}\n", "")
2637
+
expectPrintedLower(t, "@media (1px >= width) { a { color: red } }", "@media (max-width: 1px) {\n a {\n color: red;\n }\n}\n", "")
2638
+
expectPrintedLower(t, "@media (1px < width) { a { color: red } }", "@media not (max-width: 1px) {\n a {\n color: red;\n }\n}\n", "")
2639
+
expectPrintedLower(t, "@media (1px <= width) { a { color: red } }", "@media (min-width: 1px) {\n a {\n color: red;\n }\n}\n", "")
2640
+
2641
+
expectPrintedLower(t, "@media (1px < width < 2px) { a { color: red } }", "@media (not (max-width: 1px)) and (not (min-width: 2px)) {\n a {\n color: red;\n }\n}\n", "")
2642
+
expectPrintedLower(t, "@media (2px > width > 1px) { a { color: red } }", "@media (not (min-width: 2px)) and (not (max-width: 1px)) {\n a {\n color: red;\n }\n}\n", "")
2643
+
expectPrintedLower(t, "@media (1px <= width <= 2px) { a { color: red } }", "@media (min-width: 1px) and (max-width: 2px) {\n a {\n color: red;\n }\n}\n", "")
2644
+
expectPrintedLower(t, "@media (2px >= width >= 1px) { a { color: red } }", "@media (max-width: 2px) and (min-width: 1px) {\n a {\n color: red;\n }\n}\n", "")
2645
+
2646
+
expectPrintedLower(t, "@media (1px < width <= 2px) { a { color: red } }", "@media (not (max-width: 1px)) and (max-width: 2px) {\n a {\n color: red;\n }\n}\n", "")
2647
+
expectPrintedLower(t, "@media (2px > width >= 1px) { a { color: red } }", "@media (not (min-width: 2px)) and (min-width: 1px) {\n a {\n color: red;\n }\n}\n", "")
2648
+
expectPrintedLower(t, "@media (1px <= width < 2px) { a { color: red } }", "@media (min-width: 1px) and (not (min-width: 2px)) {\n a {\n color: red;\n }\n}\n", "")
2649
+
expectPrintedLower(t, "@media (2px >= width > 1px) { a { color: red } }", "@media (max-width: 2px) and (not (max-width: 1px)) {\n a {\n color: red;\n }\n}\n", "")
2650
+
2651
+
expectPrintedLower(t, "@media not (1px < width < 2px) { a { color: red } }", "@media not ((not (max-width: 1px)) and (not (min-width: 2px))) {\n a {\n color: red;\n }\n}\n", "")
2652
+
expectPrintedLower(t, "@media not (2px > width > 1px) { a { color: red } }", "@media not ((not (min-width: 2px)) and (not (max-width: 1px))) {\n a {\n color: red;\n }\n}\n", "")
2653
+
expectPrintedLower(t, "@media not (1px <= width <= 2px) { a { color: red } }", "@media not ((min-width: 1px) and (max-width: 2px)) {\n a {\n color: red;\n }\n}\n", "")
2654
+
expectPrintedLower(t, "@media not (2px >= width >= 1px) { a { color: red } }", "@media not ((max-width: 2px) and (min-width: 1px)) {\n a {\n color: red;\n }\n}\n", "")
2655
+
2656
+
expectPrintedLowerMangle(t, "@media not (1px < width < 2px) { a { color: red } }", "@media (max-width: 1px) or (min-width: 2px) {\n a {\n color: red;\n }\n}\n", "")
2657
+
expectPrintedLowerMangle(t, "@media not (2px > width > 1px) { a { color: red } }", "@media (min-width: 2px) or (max-width: 1px) {\n a {\n color: red;\n }\n}\n", "")
2658
+
expectPrintedLowerMangle(t, "@media not (1px <= width <= 2px) { a { color: red } }", "@media not ((min-width: 1px) and (max-width: 2px)) {\n a {\n color: red;\n }\n}\n", "")
2659
+
expectPrintedLowerMangle(t, "@media not (2px >= width >= 1px) { a { color: red } }", "@media not ((max-width: 2px) and (min-width: 1px)) {\n a {\n color: red;\n }\n}\n", "")
2660
+
}
2661
+
2628
2662
funcTestFontWeight(t*testing.T) {
2629
2663
expectPrintedMangle(t, "a { font-weight: normal }", "a {\n font-weight: 400;\n}\n", "")
2630
2664
expectPrintedMangle(t, "a { font-weight: bold }", "a {\n font-weight: 700;\n}\n", "")
0 commit comments