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

Test and Build

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-vue-meta-layouts

vite 的 vue-router 的元信息布局系统

314,627 65
vite-plugin-favicons-inject

A Vite plugin for creating and injecting favicons during the application build!

533,525 10
vite-plugin-use-modules

自动加载 modules

8,078 14
@vunojs/vite

Vite integration and file-based routing for Vuno.

887
vite-plugin-generate-file

Generate extra file to dist folder.

1,840,535 16

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