-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Storybook for SvelteKit? #1979
Comments
There's a project called Svench by @rixo that you should check out: https://svench-docs.vercel.app/ - probably not worth spending time making yet another Storybook alternative when one already exists :) |
Looks cool. Kit support is still WIP (rixo/svench#29) and the readme says Svench is in PoC stage, but I agree, if this project develops as far as say, MDSveX, there's no point in creating another one. |
It seems that Storybook make great efforts to implement Svelte without config https://storybook.js.org/blog/storybook-for-svelte/ |
@7antra Yeah, I tried that but just setting it up took a minute and made the fans on my machine turn wild. Since coming to Svelte, I've been trying to avoid these sorts of heavy dependencies. |
I think that |
@benmccann |
We don't have a recommended testing setup for SvelteKit yet, but would like to do that. I'd hope that it could get close to the StoryBook setup as well |
I wasn't aware that |
Nevermind. I just took a closer look at what StoryBook Docs provides and it's not really something SvelteKit does today. It would be cool to have though 😄 |
Maybe this can this be done with a vite plugin? Something like virtual modules - injecting a page with components? |
Re-implementing Storybook is not fun, I had spent a fair amount of time in the past trying to do so. There's a reason why Storybook is bulky today, e.g. component iframe isolation (leading to CSF spec), document-iframe inter-communication, plugins, and it's an app itself. With that said, there's also https://github.com/vitebook/vitebook, but from a brief look into its internals, it doesn't (and probably won't?) implement Storybook's component iframe isolation feature. But seems fairly robust to try out otherwise. |
Vitebook looks promising. It's great to see new solutions in this space. I'll definitely try it out. True component isolation in Edit: I just noticed that there already exists svelte2tsx parser that extracts component props. Maybe this can be utilized to generate docs/controls. Edit2: I'll collect relevant attempts and links here
|
Just a heads-up, there's also a vite builder for storybook which works with svelte. https://github.com/storybookjs/builder-vite. And storybook is making changes soon to avoid users having to install webpack at all, which should help a lot with dependency bloat and performance. But, for now the automatic docs generation is not hooked up. Thanks for collecting a list of projects to handle this @Tymek. If any of them output something similar to react-docgen or vue-docgen-api, then it should be a simple matter of adding support within the vite builder. |
For what it's worth, storybook with the vite builder now uses https://github.com/alexprey/sveltedoc-parser/ to generate docgen for svelte projects. However, a current limitation is that it cannot use typescript, due to KatChaotic/sveltedoc-parser#34. |
We probably won't be re-implementing all of Storybook 😄 But we are working on making Storybook and SvelteKit work together well! So I'm going to close this in favor of #5397. I have PRs out to make Storybook setup work better with |
Describe the problem
There's 2-year-old Sapper issue sveltejs/sapper-template#120 in which @Rich-Harris mentioned the possibility of developing an in-house alternative to the dependency-heavy Storybook.
Describe the proposed solution
Now that Sapper was replaced by SvelteKit, I'd be curious to hear if there's a new outlook on that?
Alternatives considered
Storybook is nice but requires some modifications to work with
"type": "module"
packages and comes with a huge list of dependencies.Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: