vite-plugin-vue-docgen
TypeScript icon, indicating that this package has built-in type declarations

0.3.4 • Public • Published

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.

/vite-plugin-vue-docgen/

    Package Sidebar

    Install

    npm i vite-plugin-vue-docgen

    Weekly Downloads

    1,823

    Version

    0.3.4

    License

    ISC

    Unpacked Size

    6.16 kB

    Total Files

    5

    Last publish

    Collaborators

    • andrewcourtice