Vue: Improve code snippets #26691
Replies: 2 comments 4 replies
-
@kasperpeulen @chakAs3 Would love your opinion on this :) |
Beta Was this translation helpful? Give feedback.
-
Point 1: There's this addon called Storysource, but it's aimed at displaying the source code of the story, not the generated code. Point 2: Bringing in this feature wouldn't just be a win for Vue users; it'd be a big deal for folks using other frameworks too. I reckon a bunch of users would really appreciate having this in their toolkit. Point 3: This feature was actually what drove me to start contributing in the first place. It's what got me hooked, and now I'm the one maintaining it. happy to have @larsrickert joining me on same path. |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
We are using Storybook to document our Vue component library. Its very useful the the code snippets are automatically generated so the user can copy it to his project.
However, we would like to have more modern code snippets that better follow common Vue best practices / are closer to the code that the user would actually use in his project. This includes:
@
shorthand for events instead ofv-on:
true
boolean props<script>
Describe the solution you'd like
I can implement the change but I want to clarify/discuss first if this feature request is also a desired change on your side.
Example:
Current snippet:
My suggestion:
Also I'd like to have a
Code
tab added when viewing a single story. Currently the source code is only available on the "Docs" page. Example:Describe alternatives you've considered
No response
Are you able to assist to bring the feature to reality?
yes, I can
Additional context
The feature could be implemented as opt-in framework option for Storybook 8 and can be changed to be the default in Storybook 9 so we don't introduce possible breaking changes for projects using custom code snippet transformers.
Beta Was this translation helpful? Give feedback.
All reactions