Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@font-face src:local(".. Black ..") gets replaced with ".. #000 .." #1058

Closed
dr-itz opened this issue Jan 15, 2019 · 2 comments · Fixed by #1077
Closed

@font-face src:local(".. Black ..") gets replaced with ".. #000 .." #1058

dr-itz opened this issue Jan 15, 2019 · 2 comments · Fixed by #1077

Comments

@dr-itz
Copy link

dr-itz commented Jan 15, 2019

Environment

  • clean-css@4.2.1
  • node.js v10.14.1
  • operating system: Windows 7

Configuration options

var CleanCSS = require('clean-css');
new CleanCSS({})

Input CSS

`@font-face {
  font-family: "Some Sans";
  font-weight: bold;
  font-style: italic;
  src: local("Some Sans Black Italic");
}

When local is any string that contains a color name with spaces on both sides of the string, the name gets replaced with the color value. If e.g. it just ends with a color name, the incorrect replacement does not happen.

Actual output CSS

@font-face{font-family:"Some Sans";font-weight:700;font-style:italic;src:local("Some Sans #000 Italic")}

Expected output CSS

@font-face{font-family:"Some Sans";font-weight:700;font-style:italic;src:local("Some Sans Black Italic")}
@Sirius-A
Copy link
Contributor

I am also facing this problem. PR with a suggested fix here #1077

@manniL
Copy link

manniL commented Aug 26, 2019

The same problem occurs when you don't have quotes around the font-family, which is also valid CSS (and often the end output from minimizers like cssnano).

 .title { font-family: Some Sans Black }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants