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

Crash when processing "font: unset" with level 2 optimizations enabled #940

Closed
nop00 opened this issue May 9, 2017 · 4 comments
Closed
Labels
Milestone

Comments

@nop00
Copy link

nop00 commented May 9, 2017

CleanCSS crashes when processing "font: unset" with level 2 optimizations enabled.
Note that it does not crash with version 4.0.12 (crashes with versions 4.1.0 and 4.1.1).

Environment

  • clean-css version 4.1.1
  • node.js version 6.10.3
  • operating system: Windows 10

Configuration options

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

Input CSS

.test {
  font: unset;
}

Output

c:\clean-css-test\node_modules\clean-css\lib\optimizer\level-2\properties\populate-components.js:30
          throw e;
          ^

TypeError: Cannot read property '1' of undefined
    at Object.font [as breakUp] (c:\clean-css-test\node_modules\clean-css\lib\optimizer\level-2\break-up.js:308:66)
    at populateComponents (c:\clean-css-test\node_modules\clean-css\lib\optimizer\level-2\properties\populate-components.js:17:42)
    at optimizeProperties (c:\clean-css-test\node_modules\clean-css\lib\optimizer\level-2\properties\optimize.js:19:3)
    at recursivelyOptimizeProperties (c:\clean-css-test\node_modules\clean-css\lib\optimizer\level-2\optimize.js:63:9)
    at level2Optimize (c:\clean-css-test\node_modules\clean-css\lib\optimizer\level-2\optimize.js:77:3)
    at optimize (c:\clean-css-test\node_modules\clean-css\lib\clean.js:131:5)
    at c:\clean-css-test\node_modules\clean-css\lib\clean.js:104:29
    at c:\clean-css-test\node_modules\clean-css\lib\reader\read-sources.js:26:64
    at loadOriginalSources (c:\clean-css-test\node_modules\clean-css\lib\reader\load-original-sources.js:26:5)
    at c:\clean-css-test\node_modules\clean-css\lib\reader\read-sources.js:26:14
@jakubpawlowicz
Copy link
Collaborator

I can see it too - please use { level: { 2: { skipProperties: ['font'] } } } until 4.1.2.

@jakubpawlowicz jakubpawlowicz added this to the 4.1.2 milestone May 9, 2017
@nop00
Copy link
Author

nop00 commented May 9, 2017

Thanks for the workaround !

jakubpawlowicz added a commit that referenced this issue May 9, 2017
Why:

* The list wasn't exhaustive, hopefully the new one is.
@jakubpawlowicz
Copy link
Collaborator

The fix is out in 4.1.2.

@nop00
Copy link
Author

nop00 commented May 10, 2017

Thanks!

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

No branches or pull requests

2 participants