#How to use asset in Storybook ?
6 messages · Page 1 of 1 (latest)
The storybook builder in angular.json can have the same "assets": [] option as an Angular app. So, using assets in a story should not be any different than in your app.
Thank you very much 🙏
@molten tendon — It looks like our docs, https://storybook.js.org/docs/angular/configure/images-and-assets, could be updated to include that detail, yeah?
Yeah. I don't think there is a problem with using Storybook's "staticDirs" config, but I updated the builder to include the "assets" option a while ago to avoid maintaining two formats.
I use the object syntax on some assets, which lets the source and destination paths be specified and I don't know if "staticDirs" allows that.
I didn't realize the builder options list doesn't include it either. I guess I just assumed those options, in the docs, were generated from the json schema. https://storybook.js.org/docs/angular/get-started/install#start-storybook
staticDirs does support an object syntax: https://storybook.js.org/docs/angular/api/main-config-static-dirs#with-configuration-objects
The options documented there are hard-coded: https://github.com/storybookjs/storybook/blob/next/docs/get-started/installation-problems/angular.mdx#L27-L43