Vue Styleguidist is a living style guide generator and isolated development environment for Vue components. It enables developers to document components with live, editable usage examples based on Markdown files, fostering a component-driven development workflow. Currently at version 4.72.4, it generally maintains a frequent patch and minor release cadence, often addressing compatibility with newer Vue versions or fixing parsing issues in its underlying `vue-docgen-api` dependency. Its key differentiators include its heritage from React Styleguidist, providing a similar interactive documentation experience, and its specific tooling for parsing and compiling `.vue` single-file components. It supports both Vue 2 and Vue 3 environments (requiring appropriate `vue-loader` and `@vue/compiler-sfc` peer dependencies respectively) and integrates with webpack for asset loading.
npm install vue-styleguidistVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up Vue Styleguidist for Vue 3 with a basic component, including a `styleguide.config.js` for webpack configuration and a `.vue` component with embedded documentation using TypeScript.
Carefully review the required peer dependencies for your specific Vue version. For Vue 3, ensure `@vue/compiler-sfc` and `vue-loader@^17` are installed. For Vue 2, use `vue-template-compiler` and `vue-loader@^15` (or older compatible versions).
For Vue 3 projects, explicitly set `compiler: 'vue-styleguidist/lib/loaders/vue-standalone-compiler'` in your `styleguide.config.js`. Ensure your `webpackConfig.resolve.alias` includes `'vue': path.resolve(__dirname, 'node_modules/vue')` and use `vue-loader` version 17 or later with compatible webpack.
Use `module.exports = { ... }` in your `styleguide.config.js` and `require()` for any Node API interactions to ensure compatibility with Vue Styleguidist's internal tooling.Thoroughly check your `webpackConfig` within `styleguide.config.js`. Ensure you have rules for `.vue` files (with `vue-loader`), `.js`/`.ts` files (with `babel-loader` or `ts-loader`), and CSS files. Verify `resolve.extensions` includes all necessary file types.
For Vue 2: `npm install vue-template-compiler`. For Vue 3: `npm install @vue/compiler-sfc`. Also, ensure `styleguide.config.js` has `compiler: 'vue-styleguidist/lib/loaders/vue-standalone-compiler'` for Vue 3.
Install `vue-loader`: `npm install vue-loader`. Then, ensure your `styleguide.config.js` `webpackConfig.module.rules` includes a rule like `{ test: /\.vue$/, loader: 'vue-loader' }`.Add a `resolve.alias` entry in your `styleguide.config.js` `webpackConfig`: `alias: { 'vue': path.resolve(__dirname, 'node_modules/vue') }`.Verify the `components` array/string in `styleguide.config.js` (e.g., `components: 'src/components/**/*.vue'`) precisely matches the actual file paths of your Vue components.