@viteplay/plugin

Setup
2,842
Install
npm install @viteplay/plugin
Latest Version:0.2.9
Vue:3
Last Updated:Aug 1, 2023
Links: npm
Maintainer: hunterliu1003

@viteplay/plugin

Setup

Shorthand version

// vite.config.ts
import { defineConfig } from "vite"
import vue from "@vitejs/plugin-vue"
import viteplay from "@viteplay/plugin"

export default defineConfig({
  plugins: [
    vue(),
    viteplay({
      // Path to extract components from
      components: "./components/*/*.vue",
      // Path to extract examples from, relative to component path
      componentExamples: "./examples/*.vue",
      // base route for the development pages
      base: "/dev",
    }),
  ],
})

Longhand version

// vite.config.ts
import { defineConfig } from "vite"
import vue from "@vitejs/plugin-vue"
import viteplay from "@viteplay/plugin"

export default defineConfig({
  plugins: [
    vue(),
    viteplay({
      pages: [
        {
          title: "My Button", // (Optional) defaults to the component name
          component: "./button/MyButton.vue",
          examples: "./button/*.example.vue",
        },
        {
          title: "My Form", // (Optional) defaults to the component name
          component: "./form/MyForm.vue",
          examples: "./form/*.example.vue",
        },
      ],
      // base route for the development pages
      base: "/dev",
    }),
  ],
})

Add to Vue Router

import { createRouter } from "vue-router"
import { pages as pagesVitePlay } from "@viteplay/vue/client"

console.log(`VitePlay development routes → `, pagesVitePlay)

export const router = createRouter({
  routes: [
    ...pagesVitePlay,
    // your other routes here...
  ],
})

Related Packages

@viteplay/vue

My awesome typescript library

3,008

Version History

Version Released Vue License
0.2.9 ^3.3.4
0.2.8 ^3.3.4
0.2.7 ^3.3.4
0.2.6 ^3.2.37
0.2.5 ^3.2.37
Pre-releases (6)
Version Released Vue License
0.0.1-alpha.1 ^3.2.26
0.0.0-alpha.4 ^3.2.26
0.0.0-alpha.3 ^3.2.26
0.0.0-alpha.2 ^3.2.26
0.0.0-alpha.1 ^3.2.26