storybook-design-token
storybook-design-token copied to clipboard
Request: allow customization of token locations
It would be super awesome to have the ability to specify a file location for the tokens! We currently have a use case where we want to store the tokens in their own package separate from our storybook implementation. So the ability to:
- Use files outside the compiler.context
- specify which file paths to ignore/ not ignore
would be awesome!
This is the relevant section of the addon code:
return glob.sync(
path.join(
compiler.context,
process.env.DESIGN_TOKEN_GLOB || '**/*.{css,scss,less,svg,png,jpeg,gif}'
),
{
ignore: ['**/node_modules/**', '**/storybook-static/**', '**/*.chunk.*']
}
);
Thanks!!
This can be achieved already? with env variables:
DESIGN_TOKEN_GLOB=../../somewhere/**/tokens.{css,scss,less,svg}
@jbvolvo Could you please provide an example how to configure this? I was following this doc - https://storybook.js.org/docs/react/configure/environment-variables#using-storybook-configuration, but didn't succeed...
@jbvolvo Could you please provide an example how to configure this? I was following this doc - https://storybook.js.org/docs/react/configure/environment-variables#using-storybook-configuration, but didn't succeed...
This method only worked for me with the using .env file. That populates the environment variables during the build phase.
This can be achieved already? with env variables:
DESIGN_TOKEN_GLOB=../../somewhere/**/tokens.{css,scss,less,svg}
Sorry I didn't clarify more! I would like to have the option to import from other sources than just a GLOB. Like a node module (which is filered out of the GLOB using the ignore param)