vite-plugin-vue-docgen
A simple vue-docgen plugin for Vite
91,834
8
| Install | |
|---|---|
npm install vite-plugin-vue-docgen |
|
| Latest Version: | 0.3.4 |
| Vue: | 3 |
| License: | ISC |
| Last Updated: | May 11, 2023 |
| Links: | GitHub · npm |
Maintainer: andrewcourtice
Vite Vue-Docgen Plugin
This is a very simple Vite plugin that wraps the Vue Docgen API for providing metadata about Vue single file components (SFC).
Usage
To use, simply import the plugin and register it after the Vue plugin in your Vite config:
// vite.config.js
import vuePlugin from '@vitejs/plugin-vue';
import vueDocgenPlugin from 'vite-plugin-vue-docgen';
export default {
plugins: [
vuePlugin(),
vueDocgenPlugin()
]
}
The docgen metadata will then be accessible as a property on the component:
import Button from './button.vue';
const {
displayName,
description,
props,
methods,
slots
} = Button.__docgenInfo;
Options
const options = {
/* Regex (optional) - The file path pattern to match */
include: /\.vue$/,
/* Regex (optional) - The file path pattern to exclude */
exclude: /\.story\.vue$/,
/* String (optional) - The property name to inject the docgen metadata at */
injectAt: '__docgenInfo'
/* Object (optional) - Specific Docgen API options */
docgenOptions: {
jsx: true
}
};
See here for a full list of docgen API options.
Related Packages
vite-plugin-favicons-inject
A Vite plugin for creating and injecting favicons during the application build!
533,525
10
Version History
| Version | Released | License |
|---|---|---|
| 0.3.4 | ISC | |
| 0.3.0 | ISC | |
| 0.2.0 | ISC | |
| 0.1.3 | ISC | |
| 0.1.2 | ISC | |
| 0.1.1 | ISC | |
| 0.1.0 | ISC |