Closed shonie closed 6 years ago
@shonie PR welcome (add some tests)! 🙂
Thank you for your response!
But before rushing into implementation, i want to discuss solution with you. I can propose two methods of fixing this.
Simplest one is to cast each variable value to string, which is safe, but not transparent.
Other, and, on my opinion better one, is to validate plugin options by some validations tool (something like schema-utils or ajv.
Me, personally, like schema-utils as it most likely to be already in client's node_modules as webpack uses it under the hood.
Thank you.
I have just now realized that ajv is strict dependency of schema-utils 😄. So better to use ajv directly.
@shonie Casting to string seems reasonable. We already do it for undefined
-> 'undefined'
, https://github.com/MadLittleMods/postcss-css-variables/pull/44
Hello!
I use your great package with this postcss.config.
I pass plain javascript object with variables to option variables. But if any variable is set to not-string value build process crashes with this TypeError.
I've created reproduce repo here.
You can do:
Can i create PR for fixing this?