Describe the bug
People write CSS like this for IE:
a::after {
display: none \9;
}
Tools such as esbuild transform this into the following equivalent CSS (the \9 has been transformed into a \ followed by a tab character):
a::after {
display: none \ ;
}
However, cssnano incorrectly minifies this code into this CSS, which contains a syntax error:
This is a bug with cssnano, not with esbuild.
Expected behaviour
I expect cssnano to preserve escaped characters in CSS identifiers, and to not turn valid CSS code into code with a syntax error. A tab character in an identifier should either be printed as \ or as \9 (of course if the tab character is printed as \9, then an additional whitespace character may be needed to avoid the hex digit 9 accidentally merging with any following characters that happen to be hex digits). You can read more about how character escapes in CSS syntax work here: https://www.w3.org/TR/css-syntax-3/#consume-escaped-code-point
Steps to reproduce
-
Open https://cssnano.github.io/cssnano/playground/ in a browser
-
Paste the following CSS into the left textarea:
a::after {
display: none \ ;
}
-
Click the Minimize button
Version
https://cssnano.github.io/cssnano/playground/
Preset
(no preset)
Environment
https://cssnano.github.io/cssnano/playground/
Package details
https://cssnano.github.io/cssnano/playground/
Additional context
See also evanw/esbuild#3929.
Describe the bug
People write CSS like this for IE:
Tools such as esbuild transform this into the following equivalent CSS (the
\9has been transformed into a\followed by a tab character):However, cssnano incorrectly minifies this code into this CSS, which contains a syntax error:
This is a bug with cssnano, not with esbuild.
Expected behaviour
I expect cssnano to preserve escaped characters in CSS identifiers, and to not turn valid CSS code into code with a syntax error. A tab character in an identifier should either be printed as
\or as\9(of course if the tab character is printed as\9, then an additional whitespace character may be needed to avoid the hex digit9accidentally merging with any following characters that happen to be hex digits). You can read more about how character escapes in CSS syntax work here: https://www.w3.org/TR/css-syntax-3/#consume-escaped-code-pointSteps to reproduce
Open https://cssnano.github.io/cssnano/playground/ in a browser
Paste the following CSS into the left textarea:
Click the Minimize button
Version
https://cssnano.github.io/cssnano/playground/
Preset
(no preset)
Environment
Package details
Additional context
See also evanw/esbuild#3929.