postcss / postcss-url

PostCSS plugin to rebase url(), inline or copy asset.
MIT License
377 stars 59 forks source link

do not use path.dirname() on undefined #68

Closed jonathanong closed 8 years ago

jonathanong commented 8 years ago

https://github.com/postcss/postcss-url/blob/743190d1adc0a1467784962c5b31fcb3f926e6e1/index.js#L131

this line is breaking my node@6 builds. here's an example: https://travis-ci.org/mgmtio/assets/jobs/126286844

one solution would be to check that .file is defined. i'm not sure what it is so i don't know. if it's required, then it's a bug for me

MoOx commented 8 years ago

Maybe testing that "decl.source.input.file" value is present is enough? Not sure how it breaks with node 6...

jonathanong commented 8 years ago

node 6 just throws if values passed to path.dirname() is undefined now. before, it didn't throw.

MoOx commented 8 years ago

So I guess here https://github.com/postcss/postcss-url/blob/743190d1adc0a1467784962c5b31fcb3f926e6e1/index.js#L130 we could add another condition on input ?

jonathanong commented 8 years ago

Yeah I think so

MoOx commented 8 years ago

Patch released in 5.1.2

jonathanong commented 8 years ago

👍 thanks