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-variation-settings getting quotes stripped & shouldn't #1038

Closed
jpamental opened this issue Jul 20, 2018 · 0 comments
Closed

Font-variation-settings getting quotes stripped & shouldn't #1038

jpamental opened this issue Jul 20, 2018 · 0 comments

Comments

@jpamental
Copy link
Contributor

I've found that the new font-variation-settings CSS attribute is getting quotes stripped out when it should not (it should work just like font-feature-settings, which are handled properly). I found the line and included a change below.

Precheck

  • Do a quick search and make sure a bug has not yet been reported;
  • do a quick check if the bug still exists in the latest patch version;
  • finally, be nice and have fun!

Environment

  • clean-css version - npm ls clean-css: v4.1.11
  • node.js version - node -v: v8.11.3
  • operating system: Mac OS High Sierra

Configuration options

var CleanCSS = require('clean-css');
new CleanCSS({
  // compatibility: 'ie8',
  // format: 'keep-breaks',
  // level: 2
})

Input CSS

h2 {
 font-variation-settings: 'wght' 600 'opz' 48;
}

Actual output CSS

h2 {
 font-variation-settings: wght 600 opz 48;
}

Expected output CSS

h2 {
 font-variation-settings: 'wght' 600 'opz' 48;
}

I found the line in /lib/optimizer/level-1/optimize.js, line 337:
if (name == 'content' || name.indexOf('font-feature-settings') > -1 ||

if changed to this:

if (name == 'content' || name.indexOf('font-variation-settings') > -1 || name.indexOf('font-feature-settings') > -1 ||

fixes the issue

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

No branches or pull requests

2 participants