-
Notifications
You must be signed in to change notification settings - Fork 39
Description
In development mode we'd like to trigger Storybook to hot reload new story definitions if the underlying Rails code changes. In particular we'd like to catch:
- Changes to the Ruby Stories
- Changes to the ViewComponents
- Change to the VewComponent views
The good news is Storybook is smart enough to reload of the stories.json file changes. We just need to make that happen.
Using something like https://github.com/guard/listen seems pretty straight forward. Catching the first case is the easiest. The other cases are a bit more tricky. The question is can we target the JSON recompilation for only the necessary files. While it might be likely that by naming convention Story files have are 1-to-1 on the components the describe we want to support mixed or other naming conventions. The problem there is knowing which Stories have dependencies on which components.
a) we could regenerate all json anytime a file changes. Might be slow with lots of components
b) interrogate the Stories files to see which components they preview and trigger writing json for the dependent ones.