包详细信息

vite-plugin-html-banner

ljw14128MIT0.0.3

Adds a banner to the top of generated html.

vite, vite plugin, vite banner, plugin

自述文件

vite-plugin-html-banner

This is an extension plugin for the vite.

Adds a banner to the generated html.

Installation

$ npm install -d vite-plugin-html-banner
$ yarn add -D vite-plugin-html-banner

Basic Usage

Load the plugin.

const htmlBanner = require('vite-plugin-html-banner')

And add it to your vite.config.js config as follows:

import { defineConfig } from 'vite'
import htmlBanner from 'vite-plugin-html-banner'

export default defineConfig({
  plugins: [htmlBanner('hello world')],
})

You will get the following results:

<!--hello world-->
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title></title>
  </head>
  <body></body>
</html>

Options

htmlBanner(options)

options: string | string[] | { content: string | string[] }

Enter a string or array as follows:

htmlBanner('hello world')
// If you enter an array, it will be automatically converted to a string separated by '\n'.
htmlBanner(['hello world'])

Or enter a object as follows:

(features will be added in the future)

htmlBanner({ content: 'hello world' })
htmlBanner({ content: ['hello world'] })

License

MIT