node-csswring icon indicating copy to clipboard operation
node-csswring copied to clipboard

Object false has no method 'alpha'

Open MoOx opened this issue 11 years ago • 2 comments

Not sure what is creating this issue. Maybe you should catch this error to give source (file:line:column) when possible ? For the postcss plugins I've made I'm using this function

https://github.com/postcss/postcss-custom-properties/blob/2304d37b59b9ee430f1abf3c2ce5254e23e9b069/index.js#L161-L169

Here is the error I got, not clue where it is, my css is too big :D

events.js:72
        throw er; // Unhandled 'error' event
              ^
TypeError: Object false has no method 'alpha'
    at toRGBColor ($PROJECT/node_modules/gulp-cssnext/node_modules/cssnext/node_modules/csswring/lib/csswring.js:51:13)
    at String.replace (native)
    at wringValue ($PROJECT/node_modules/gulp-cssnext/node_modules/cssnext/node_modules/csswring/lib/csswring.js:94:17)
    at Array.map (native)
    at wringDecl ($PROJECT/node_modules/gulp-cssnext/node_modules/cssnext/node_modules/csswring/lib/csswring.js:305:18)
    at $PROJECT/node_modules/gulp-cssnext/node_modules/cssnext/node_modules/postcss/lib/container.js:402:30
    at Rule.proto$0.each ($PROJECT/node_modules/gulp-cssnext/node_modules/cssnext/node_modules/postcss/lib/container.js:88:20)
    at Rule.Container.WithDecls.proto$0.eachDecl ($PROJECT/node_modules/gulp-cssnext/node_modules/cssnext/node_modules/postcss/lib/container.js:400:21)
    at $PROJECT/node_modules/gulp-cssnext/node_modules/cssnext/node_modules/postcss/lib/container.js:331:36
    at Root.proto$0.each ($PROJECT/node_modules/gulp-cssnext/node_modules/cssnext/node_modules/postcss/lib/container.js:88:20)

MoOx avatar Oct 15 '14 07:10 MoOx

This seems CSSWring's color extraction regexp problem (not CSS). Can you upload your big CSS?

Also I think catching an error like that is not a PostCSS plugin's job.

hail2u avatar Oct 15 '14 08:10 hail2u

Can't share my CSS sorry.

But I really think csswring should take care of the error it can throw.

MoOx avatar Nov 18 '14 08:11 MoOx