Lullabot / storybook-drupal-addon

Storybook addon to facilitate integrating Storybook with Drupal projects.
MIT License
42 stars 9 forks source link

Add a flag to download assets locally #42

Open paulsheldrake opened 1 year ago

paulsheldrake commented 1 year ago

Hello, this is a feature request. We're working on a project, and we'd like the storybook UI to generate a static version that can be shared without the Drupal site running.

I was wondering about the feasibility of getting a flag in the storybook config that would allow it to support that.

A couple of changes I think would need to be made:

Ideally, we could then add a param to the storybook command that would be like. npm run storybook --server-static --out=.out and it would make the magic happen.

Looking forward to hearing your thoughts

agarzola commented 1 year ago

I haven't tried to do this yet with a Storybook install that works with server-rendered components, but Storybook supports generating a static webapp. Have you tried that?

paulsheldrake commented 1 year ago

We have tried that as we use the static feature but the site ends up making a request to the URL listed in the server config. What I'm hoping for a is a way to work around that dependency

agarzola commented 1 year ago

Ah, interesting! I guess when Storybook is configured to use server-rendered components, it does not include the components in that static build. Which I suppose is a reasonable default, but I can see how it sort of defeats the purpose of generating a static build in the first place, depending on your expectation of what falls within the scope the “static build.”

This storybookjs/storybook comment describes what you are referring to, I think. I suggest voicing your interest in better support for server-side rendered components in that issue as well.

danny-englander commented 1 year ago

Just noting that there is a storybook build command that will compile all the components as a static site.

agarzola commented 1 year ago

It appears that command does not include proactively generating static files for server-rendered components.

fogpuddle commented 8 months ago

Any update on this? I am looking how to generate storybook files that can be publicly accessible while still using cl_server for development. I haven't tried adjusting CORS settings so Storybook can run on production with cl_server yet, but I would prefer a static storybook build without the dependency of Drupal as mentioned here.