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: normal; causes error which quite hard to find #1008

Closed
thekip opened this issue Feb 23, 2018 · 3 comments · Fixed by dalton-0x0/cohort3#38 or grechut/watchdog#41 · May be fixed by kosiakMD/progressive_optimistic_ui#1, JuliusMorkunas/liker#16 or m0rphtail/Teleport#4
Labels
Milestone

Comments

@thekip
Copy link

thekip commented Feb 23, 2018

Incorrect value in font rule leads to an error which really hard to find.

I'm using clean-css as part of Angular Cli project, and I had to debug it manually to find what part of css cause this error.

Environment

  • clean-css version - 4.1.9:
  • node.js version - v9.6.1:
  • operating system: Windows x64

Configuration options

const cleancss = new CleanCSS({
  compatibility: 'ie9',
  level: 2,
  inline: false,
  returnPromise: true,
});

Input CSS

  div {
      font: normal;
    }

Actual output

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

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

It may be related to #1006

@jakubpawlowicz
Copy link
Collaborator

It's not related and will be fixed in 4.1.10.

@jakubpawlowicz jakubpawlowicz added this to the 4.1.10 milestone Mar 5, 2018
jakubpawlowicz added a commit that referenced this issue Mar 5, 2018
`font` shorthand needs `font-size` and `font-family`.
@jakubpawlowicz
Copy link
Collaborator

It's fixed in 4.1.10 now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment