You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The syntax for a <font-face-name> is a unique font face name enclosed by "local(" and ")". The name can optionally be enclosed in quotes. If unquoted, the unquoted font family name processing conventions apply; the name must be a sequence of identifiers separated by whitespace which is converted to a string by joining the identifiers together separated by a single space.
It looks like the bug originates from postcss-colormin, which tries to minify color names within too many contexts without limiting oneself to the contexts where only colors can appear.
Maybe it's a good idea to add the following test to cssnano/packages/postcss-colormin/test/index.js and make it pass:
test('should not attempt to convert unquoted font names',passthroughCSS('@font-face{src:local(Noto Sans Black)}'));
Expected behaviour
@font-face{src:local(Black Font Name)}
Steps to reproduce
Minify the stylesheet provided above with cssnano playground or latest (5.1.14) version of cssnano.
Bug Description
Consider the following CSS (all irrelevant properties are omitted):
Here,
Black
is misinterpreted bycssnano
as the name of the color, resulting in:However, if one quotes a font face name, the problem disappears:
The above example minifies to:
However, according to CSS Fonts Module Level 3 W3C recommendation, quotes are optional:
It looks like the bug originates from
postcss-colormin
, which tries to minify color names within too many contexts without limiting oneself to the contexts where only colors can appear.Maybe it's a good idea to add the following test to
cssnano/packages/postcss-colormin/test/index.js
and make it pass:Expected behaviour
Steps to reproduce
Minify the stylesheet provided above with cssnano playground or latest (
5.1.14
) version ofcssnano
.Version
5.1.14
Preset
default
Environment
The text was updated successfully, but these errors were encountered: