vite-plugin-vanilla
v1.1.0
Published
Vanilla multi-page web development model based on Vite.
Downloads
464
Readme
vite-plugin-vanilla
Vanilla multi-page web development model based on Vite
.
基于 Vite
的传统多页面 web 开发模式。
Installation
npm i vite-plugin-vanilla -D
Usage
import { defineConfig } from 'vite'
import vanilla from 'vite-plugin-vanilla'
export default defineConfig({
plugins: [
vanilla('src/pages/**/*.html', {
base: 'src/pages',
}),
],
})
// `/index.html` -> src/pages/index.html
// `/about/index.html` -> src/pages/about/index.html
API
vanilla(pagePatterns, options)
pagePatterns
- Type:
string | string[]
The glob pattern of pages.
options
| Name | Type | Default | Description |
| --------------- | ---------------------------- | ------- | ------------------------------------- |
| base
| string
| 'src'
| The base directory of pages. |
| minify
| boolean
| true
| Whether to minify the HTML. |
| transform
| Transform
| | Transform the HTML. |
| inject
| {tags:HtmlTagDescriptor[]}
| | Inject the HTML Tags. |
| replaceDefine
| boolean
| true
| Static replace vite.define
in HTML. |
options.transform
type Transform = (
html: string,
ctx: { originalUrl?: string; path: string }
) => Promise<string> | string
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.