Navigation Menu

Skip to content

Commit

Permalink
fix #2116: support @counter-style
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Mar 24, 2022
1 parent 6fc8aa8 commit cce4392
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
9 changes: 5 additions & 4 deletions CHANGELOG.md
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions internal/css_parser/css_parser.go
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions internal/css_parser/css_parser_test.go
Expand Up @@ -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: ": ";
}
`)
}

Expand Down

0 comments on commit cce4392

Please sign in to comment.