vite-plugin-version-output
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

vite-plugin-version-output

Automatically insert the version in your project

Downloads Version License

Install

pnpm install -D vite-plugin-version-output
# OR yarn add -D vite-plugin-version-output
# OR npm install -D vite-plugin-version-output

Usage

// vite.config.ts
import { defineConfig } from 'vite'
import { vitePluginVersionOutput } from 'vite-plugin-version-output'

export default defineConfig({
  plugins: [
    vitePluginVersionOutput({
      // name: 'test-app',
      // version: '0.0.1',
      json: {
        enable: true,
        fileName: 'version.json'
      },
      html: {
        enable: true,
        toMeta: true,
        toConsole: true,
        toGlobal: true
      },
    })
  ],
})

Config

vite-plugin-version-output can be print application version in the Console or add <meta> in HTML element.

  • name - application name (name in package.json by default)
  • version - application version (version in package.json by default)
  • html - HTML output config
    • enable - enable HTML output (true by default)
    • ifMeta - add <meta name="application-name" content="{APPNAME_VERSION}: {version}"> in the <head> (true by default)
    • ifConsole - print info in the Console (true by default)
    • ifGlobal - set a variable named `__${APPNAME}_VERSION__` in the window. (true by default)
  • json - JSON output config
    • enable - enable JSON output (true by default)
    • fileName - output file name (version.json by default) Then you can use vite-plugin-version-output ! 🎉

Thanks

Readme

Keywords

Package Sidebar

Install

npm i vite-plugin-version-output

Weekly Downloads

2

Version

0.0.5

License

MIT

Unpacked Size

8.76 kB

Total Files

5

Last publish

Collaborators

  • miclon