wingsuit-designsystem / wingsuit

Twig for Storybook
GNU General Public License v2.0
90 stars 16 forks source link

Allow global vars JSON to be configured by environment variable #233

Open jowan opened 1 year ago

jowan commented 1 year ago

HI,

I am still using wingsuit 1.1.0 as I have patched it to do lots of funky things for my use case - mostly around subthemeing.

One thing I need to do is:

be able to specify which JSON file is picked up and loaded for global twig variables. I really want to do this using an environment variable in my .env file.

I would like to have a structure like this

/apps/storybook/config/theme_a/vars.json
/apps/storybook/config/theme_b/vars.json

and in my .env

### BUILD VARS
THEME=theme_a

This would then load the correct vars.json. Or something along those lines.

So, the question is - where in wingsuit's code do I start hacking around to allow the injection of this environment variables OR is there another way to do this ? How did you manage to load these vars anyway ? can I replicate that in a custom node module perhaps using the same approach and store to json files else where ?

Thanks again for a great platform :)