Skip to content

Commit 6fc8aa8

Browse files
committed
fix #2115: support @font-palette-values
1 parent 2296f46 commit 6fc8aa8

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
* Add support for some new CSS rules ([#2115](https://github.com/evanw/esbuild/issues/2115))
6+
7+
This release adds support for [`@font-palette-values`](https://drafts.csswg.org/css-fonts-4/#font-palette-values):
8+
9+
```css
10+
/* Original code */
11+
@font-palette-values Foo { base-palette: 1; }
12+
13+
/* Old output (with --minify) */
14+
@font-palette-values Foo{base-palette: 1;}
15+
16+
/* New output (with --minify) */
17+
@font-palette-values Foo{base-palette:1}
18+
```
19+
320
## 0.14.27
421

522
* Avoid generating an enumerable `default` import for CommonJS files in Babel mode ([#2097](https://github.com/evanw/esbuild/issues/2097))

internal/css_parser/css_parser.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,9 @@ var specialAtRules = map[string]atRuleKind{
681681

682682
// Reference: https://drafts.csswg.org/css-nesting-1/
683683
"nest": atRuleDeclarations,
684+
685+
// Reference: https://drafts.csswg.org/css-fonts-4/#font-palette-values
686+
"font-palette-values": atRuleDeclarations,
684687
}
685688

686689
type atRuleValidity uint8

internal/css_parser/css_parser_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,23 @@ func TestAtRule(t *testing.T) {
849849
content: "rb";
850850
}
851851
}
852+
`)
853+
854+
// https://drafts.csswg.org/css-fonts-4/#font-palette-values
855+
expectPrinted(t, `
856+
@font-palette-values Augusta {
857+
font-family: Handover Sans;
858+
base-palette: 3;
859+
override-colors: 1 rgb(43, 12, 9), 2 #000, 3 var(--highlight)
860+
}
861+
`, `@font-palette-values Augusta {
862+
font-family: Handover Sans;
863+
base-palette: 3;
864+
override-colors:
865+
1 rgb(43, 12, 9),
866+
2 #000,
867+
3 var(--highlight);
868+
}
852869
`)
853870
}
854871

0 commit comments

Comments
 (0)