diff --git a/CHANGELOG.md b/CHANGELOG.md index 206812c0b44..77cf0d1f345 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,19 +2,20 @@ ## Unreleased -* Add support for some new CSS rules ([#2115](https://github.com/evanw/esbuild/issues/2115)) +* Add support for some new CSS rules ([#2115](https://github.com/evanw/esbuild/issues/2115), [#2116](https://github.com/evanw/esbuild/issues/2116)) - This release adds support for [`@font-palette-values`](https://drafts.csswg.org/css-fonts-4/#font-palette-values): + This release adds support for [`@font-palette-values`](https://drafts.csswg.org/css-fonts-4/#font-palette-values) and [`@counter-style`](https://developer.mozilla.org/en-US/docs/Web/CSS/@counter-style): ```css /* Original code */ @font-palette-values Foo { base-palette: 1; } + @counter-style bar { symbols: b a r; } /* Old output (with --minify) */ - @font-palette-values Foo{base-palette: 1;} + @font-palette-values Foo{base-palette: 1;}@counter-style bar{symbols: b a r;} /* New output (with --minify) */ - @font-palette-values Foo{base-palette:1} + @font-palette-values Foo{base-palette:1}@counter-style bar{symbols:b a r} ``` ## 0.14.27 diff --git a/internal/css_parser/css_parser.go b/internal/css_parser/css_parser.go index 2d8869cbd70..06e490ca4d5 100644 --- a/internal/css_parser/css_parser.go +++ b/internal/css_parser/css_parser.go @@ -684,6 +684,10 @@ var specialAtRules = map[string]atRuleKind{ // Reference: https://drafts.csswg.org/css-fonts-4/#font-palette-values "font-palette-values": atRuleDeclarations, + + // Documentation: https://developer.mozilla.org/en-US/docs/Web/CSS/@counter-style + // Reference: https://drafts.csswg.org/css-counter-styles/#the-counter-style-rule + "counter-style": atRuleDeclarations, } type atRuleValidity uint8 diff --git a/internal/css_parser/css_parser_test.go b/internal/css_parser/css_parser_test.go index 323e5d3467b..7629160fc87 100644 --- a/internal/css_parser/css_parser_test.go +++ b/internal/css_parser/css_parser_test.go @@ -866,6 +866,20 @@ func TestAtRule(t *testing.T) { 2 #000, 3 var(--highlight); } +`) + + // https://drafts.csswg.org/css-counter-styles/#the-counter-style-rule + expectPrinted(t, ` + @counter-style box-corner { + system: fixed; + symbols: ◰ ◳ ◲ ◱; + suffix: ': ' + } + `, `@counter-style box-corner { + system: fixed; + symbols: ◰ ◳ ◲ ◱; + suffix: ": "; +} `) }