cssshrink icon indicating copy to clipboard operation
cssshrink copied to clipboard

Invalid font-family gets TypeError

Open dy opened this issue 11 years ago • 1 comments

I have wrong font-family value: font-family:13px, and cssshrink CLI gets:

/usr/local/lib/node_modules/cssshrink/lib/visitors/font-family-generic.js:28
      var value = node[2][i][1].toLowerCase();
                                ^
TypeError: Object number,13 has no method 'toLowerCase'
    at Object.module.exports.process (/usr/local/lib/node_modules/cssshrink/lib/visitors/font-family-generic.js:28:33)
    at tree (/usr/local/lib/node_modules/cssshrink/node_modules/gonzales-ast/lib/traverse.js:7:20)
    at tree (/usr/local/lib/node_modules/cssshrink/node_modules/gonzales-ast/lib/traverse.js:15:13)
    at tree (/usr/local/lib/node_modules/cssshrink/node_modules/gonzales-ast/lib/traverse.js:15:13)
    at tree (/usr/local/lib/node_modules/cssshrink/node_modules/gonzales-ast/lib/traverse.js:15:13)
    at /usr/local/lib/node_modules/cssshrink/node_modules/gonzales-ast/lib/traverse.js:24:11
    at Array.forEach (native)
    at Object.traverse (/usr/local/lib/node_modules/cssshrink/node_modules/gonzales-ast/lib/traverse.js:23:12)
    at traverseAST (/usr/local/lib/node_modules/cssshrink/lib/shrink.js:50:15)
    at Object.shrink (/usr/local/lib/node_modules/cssshrink/lib/shrink.js:66:9)

It took a while to find out that CSS was invalid. It would be great to log a bit more humanized error messages.

dy avatar Jul 22 '14 12:07 dy

Hehe, just had this error aswel, searched 20 minutes for it. Indeed, a more humanized error would be nice :D

gijsroge avatar Sep 11 '14 20:09 gijsroge