-
Notifications
You must be signed in to change notification settings - Fork 32
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
Express meta as JS #135
Comments
The issue here is that "meta" should be statically analyzed to be part of the stories index. It's doable but not easy to do if it's plain JavaScript. |
If it's in JavaScript couldn't you just use it directly rather than trying to statically analyze it? |
It's not possible afaik. At least the first version of this plugin had been rejected because of that ^^ You have to extract a "stories.json" at compile time. Storybook uses an AST from Babel to do that - cf https://github.com/storybookjs/storybook/tree/next/code/lib/csf-tools At least 3 properties should be exported at compile time: an id, a title, and the list of tags - https://github.com/storybookjs/addon-svelte-csf/pull/134/files#diff-268ed31ede4f019aa45638117dd2ee766a1f44800c8f9d9a8b7557cce061a9c0L144 Others properties/parameters could be read at runtime. |
I have an implementation of this issue in #134 |
I'm not quite sure how to interpret these two seemingly conflicting statements 😆 It sounds like you originally thought it wasn't possible, but then figured it out, so I wanted to clarify if that's right? |
Sorry, I was talking about this:
It's not possible because it has to be parsed at compile time. It's implemented here in the PR: https://github.com/storybookjs/addon-svelte-csf/pull/134/files#diff-268ed31ede4f019aa45638117dd2ee766a1f44800c8f9d9a8b7557cce061a9c0R168 |
This idea courtesy of @JReinhold. It might be more natural to express
meta
as JS within the.svelte
file leaving Svelte syntax for the stories themselves.The text was updated successfully, but these errors were encountered: