Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: allow customization of token locations #119

Open
emzarts opened this issue Jul 28, 2022 · 4 comments
Open

Request: allow customization of token locations #119

emzarts opened this issue Jul 28, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@emzarts
Copy link

emzarts commented Jul 28, 2022

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:

  1. Use files outside the compiler.context
  2. 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!!

@jbvolvo
Copy link

jbvolvo commented Jul 29, 2022

This can be achieved already? with env variables:
DESIGN_TOKEN_GLOB=../../somewhere/**/tokens.{css,scss,less,svg}

@mis6ko13
Copy link

mis6ko13 commented Aug 5, 2022

@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...

@emzarts
Copy link
Author

emzarts commented Aug 5, 2022

@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.

@emzarts
Copy link
Author

emzarts commented Aug 5, 2022

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)

@Sqrrl Sqrrl added the enhancement New feature or request label Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants