Movatterモバイル変換


[0]ホーム

URL:


Skip to content
NxNxDocs
ContactTry Nx Cloud for free
GitHubYouTubeXDiscord

This guide will walk you through setting upStorybook for Vue and Nuxt projects in your Nx workspace.

Generate Storybook Configuration for a Vue or Nuxt project

Section titled “Generate Storybook Configuration for a Vue or Nuxt project”

You can generate Storybook configuration for an individual Vue or Nuxt project by using the@nx/vue:storybook-configuration generator, like this:

nxg@nx/vue:storybook-configurationproject-name

The@nx/vue:storybook-configuration generator has the option to automatically generate*.stories.ts files for each component declared in the library.

<some-folder>/
├── MyComponent.vue
└── MyComponent.stories.ts

If you add more components to your project, and want to generate stories for all your (new) components at any point, you can use the@nx/vue:stories generator:

nxg@nx/vue:stories--project=<project-name>

Let's take for a example a library in your workspace, underlibs/feature/ui, calledfeature-ui. This library contains a component, calledmy-button.

The command to generate stories for that library would be:

nxg@nx/vue:stories--project=feature-ui

and the result would be the following:

  • Directoryworkspacename/
    • Directoryapps/
    • Directorylibs/
      • Directoryfeature/
        • Directoryui/
          • Directory.storybook/
        • Directorysrc/
          • Directorylib/
            • Directorymy-button/
              • MyButton.vue
              • MyButton.stories.ts
              • etc...
          • etc...
        • README.md
        • tsconfig.json
        • etc...
      • etc...
    • nx.json
    • package.json
    • README.md
    • etc...

You can find all Storybook-related Nx topicshere.

For more on using Storybook, see theofficial Storybook documentation.


[8]ページ先頭

©2009-2025 Movatter.jp