Skip to content

Commit

Permalink
fix evanw#2115: support @font-palette-values
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw authored and hardfist committed Mar 28, 2022
1 parent 36692f7 commit 8b0337d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,22 @@
# Changelog

## Unreleased

* Add support for some new CSS rules ([#2115](https://github.com/evanw/esbuild/issues/2115))

This release adds support for [`@font-palette-values`](https://drafts.csswg.org/css-fonts-4/#font-palette-values):

```css
/* Original code */
@font-palette-values Foo { base-palette: 1; }

/* Old output (with --minify) */
@font-palette-values Foo{base-palette: 1;}

/* New output (with --minify) */
@font-palette-values Foo{base-palette:1}
```

## 0.14.27

* Avoid generating an enumerable `default` import for CommonJS files in Babel mode ([#2097](https://github.com/evanw/esbuild/issues/2097))
Expand Down
3 changes: 3 additions & 0 deletions internal/css_parser/css_parser.go
Expand Up @@ -681,6 +681,9 @@ var specialAtRules = map[string]atRuleKind{

// Reference: https://drafts.csswg.org/css-nesting-1/
"nest": atRuleDeclarations,

// Reference: https://drafts.csswg.org/css-fonts-4/#font-palette-values
"font-palette-values": atRuleDeclarations,
}

type atRuleValidity uint8
Expand Down
17 changes: 17 additions & 0 deletions internal/css_parser/css_parser_test.go
Expand Up @@ -849,6 +849,23 @@ func TestAtRule(t *testing.T) {
content: "rb";
}
}
`)

// https://drafts.csswg.org/css-fonts-4/#font-palette-values
expectPrinted(t, `
@font-palette-values Augusta {
font-family: Handover Sans;
base-palette: 3;
override-colors: 1 rgb(43, 12, 9), 2 #000, 3 var(--highlight)
}
`, `@font-palette-values Augusta {
font-family: Handover Sans;
base-palette: 3;
override-colors:
1 rgb(43, 12, 9),
2 #000,
3 var(--highlight);
}
`)
}

Expand Down

0 comments on commit 8b0337d

Please sign in to comment.