0.1.1-divRIOTS.0 • Published 2 years ago

@divriots/vite-plugin-vue-docgen v0.1.1-divRIOTS.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

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 */
    pattern: /\.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.