- Issue created by @yustinTR
- πΊπΈUnited States agentrickard Georgia (US)
See the README, quoted here.
If you want to monitor story changes to compile Twig stories into JSON, execute it with `watch`. Like so:
watch --color drush storybook:generate-all-stories
The watch package is standard on ddev and most Linux systems.
- Status changed to Closed: works as designed
9 months ago 2:35pm 11 July 2024 - First commit to issue fork.
- π¬π§United Kingdom rattusrattus
Possible the OP was asking hot we get storybook to reload when we make change to SDC twig\css\JS - something I am also thinking about...
- π¬π§United Kingdom rattusrattus
I guess this (unanswered) issue is relevant: https://github.com/storybookjs/storybook/discussions/15873
- π¬π§United Kingdom rattusrattus
Actually, the above not so relevant but this one is pretty much the same problem:
https://stackoverflow.com/questions/77044691/how-can-i-force-storybook-t... - π©πͺGermany fisherman90 Dortmund
+1 For this feature, been looking through the docs of storybook and webpack, but I cannot make out, how to tell them to hot-reload stories, when the CSS files change.
I tried to add the scss compilation to storybooks webpack-config, and got the compilation working, but it still did not trigger the reloading of the stories when needed.
If I remember right, hot-reloading was possible in the past with the drupal-storybook-addon - but I'm not 100% sure.
We either need to manually trigger the storybook reload - or find a way to tell it, that it should watch the files that are picked up as sdc-libraries automatically - and reload on changes of them.
Sadly without hot-reloading frontend-development with storybook is more painful than it needs to be :D
- π¬π§United Kingdom rattusrattus
@fisherman90 definitely possible using the addon as this is what I've ended up reverting to.
- Status changed to Active
2 months ago 11:38am 2 February 2025 This issue I think is quite considerable when it comes to development efficiency.
@rattusrattus #9 - Wondering what's the difference as to implementation that makes it work. I guess `server-webpack5` is used on both approaches?Based on my previous comment, created this PoC. If somebody can come with more cleaner approach, would be great.
The possible downside - `stories.json` will get modified. Is it a problem? Probably not if those are .gitignore'd & built on CI/CD side. The logic could be further improved to generate a hash and then remove it.You can ignore my previous approach, as it can be achieved a lot easier. I just looked at the old `storybook-druplal-addon` and took the logic from preview.js.
https://gist.github.com/DavisAre/be2c4b74eb60d4dd1d6030729365b6e0
I'm following SDC approach, so I have a .scss & .js within the specific component directory that is packed using webpack. Make sure that the assets are not cached by local server to see live changes.