postcss / postcss-cli

CLI for postcss
Other
836 stars 93 forks source link

How to pass arbitrary arguments to configure a plugin option #333

Closed MattTreichelYeah closed 4 years ago

MattTreichelYeah commented 4 years ago

Hi, I wanted to use this tool so I could pass a dynamic value to set as an option for a plugin, but I can't see how that's possible? Can I not add additional arbitrary properties to the ctx? Maybe I'm missing something obvious, seems like a simple use case.

For example, I want to specify on the cli an arbitrary string value to use as an option for postcss-replace.

RyanZim commented 4 years ago

You'll have to set it as an environment variable, and read it in the config file from process.env https://nodejs.org/api/process.html#process_process_env