Storybook Angular dynamic theme switching using storybook-dark-mode #8191
-
I've been trying to get my head around configuring dynamic theme switching in storybook. I followed the guide provided here and it works in serving the application using |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Greetings, |
Beta Was this translation helpful? Give feedback.
-
When you build your Angular app with ng build, two files named I added this line to Storybook's main.ts file:
Now, a few notes: • I am not sure how to configure Storybook to build • By setting the I have created this pull request so that you can review the changes more easily. I would also like to mention two points: • In your
|
Beta Was this translation helpful? Give feedback.
When you build your Angular app with ng build, two files named
dark.css
anddefault.css
are generated in the root of your bundled build of Angular project. However, this does not happen with Storybook build. This causes an error when you try to change the Storybook theme because thedark.css
file is not found. The solution is to add yourdark.css
anddefault.css
files as Storybook's static assets so that they are available when you build or serve Storybook. If you want to learn how to add static assets to your Storybook, please refer to this link.I added this line to Storybook's main.ts file: