All Projects → IndexXuan → vite-plugin-html-template

IndexXuan / vite-plugin-html-template

Licence: other
html template for vite, like html-webpack-plugin for webpack.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to vite-plugin-html-template

vite-plugins
🌱 为社区尽一份绵薄之力
Stars: ✭ 63 (-35.05%)
Mutual labels:  vite, vite-plugin
vite-plugin-sleep
a vite plugin you never need. slow devServer and slow HMR.
Stars: ✭ 77 (-20.62%)
Mutual labels:  vite, vite-plugin
vite-plugin-ssr
Like Next.js / Nuxt but as do-one-thing-do-it-well Vite plugin.
Stars: ✭ 1,703 (+1655.67%)
Mutual labels:  vite, vite-plugin
vite-plugin-restart
Custom files/globs to restart Vite server
Stars: ✭ 92 (-5.15%)
Mutual labels:  vite, vite-plugin
vite-plugin-checker
💬 Vite plugin that provide checks of TypeScript, ESLint, vue-tsc, and more.
Stars: ✭ 338 (+248.45%)
Mutual labels:  vite, vite-plugin
vite-plugin-radar
All in one analytics loader for vite
Stars: ✭ 64 (-34.02%)
Mutual labels:  vite, vite-plugin
vite-plugin-webfont-dl
⚡ Webfont Download Vite Plugin - Make your Vite site load faster
Stars: ✭ 69 (-28.87%)
Mutual labels:  vite, vite-plugin
vite-plugin-dts
A vite plugin for generating `.d.ts` files.
Stars: ✭ 539 (+455.67%)
Mutual labels:  vite, vite-plugin
vite-plugin-inspect
Inspect the intermediate state of Vite plugins
Stars: ✭ 491 (+406.19%)
Mutual labels:  vite, vite-plugin
vite-plugin-compress
Compress your bundle + assets from Vite
Stars: ✭ 103 (+6.19%)
Mutual labels:  vite, vite-plugin
vite-plugin-banner
A banner plugin for Vite. It can adds a banner to the top of each generated chunk.
Stars: ✭ 39 (-59.79%)
Mutual labels:  vite, vite-plugin
vite-plugin-md
Markdown with Vue for Vite
Stars: ✭ 289 (+197.94%)
Mutual labels:  vite, vite-plugin
vite-plugin-environment
Easily expose environment variables in Vite.js
Stars: ✭ 57 (-41.24%)
Mutual labels:  vite, vite-plugin
vite-plugin-relay
A vite plugin for Relay
Stars: ✭ 44 (-54.64%)
Mutual labels:  vite, vite-plugin
vite-plugin-env-compatible
Environment Variables Compatible for vite(with vue-cli, create-react-app and so on)
Stars: ✭ 35 (-63.92%)
Mutual labels:  vite, vite-plugin
supabase-schema
Secured & Simple Supabase Schema Visualizer
Stars: ✭ 216 (+122.68%)
Mutual labels:  vite
Vue Vben Admin
A modern vue admin. It is based on Vue3, vite and TypeScript. It's fast!
Stars: ✭ 8,036 (+8184.54%)
Mutual labels:  vite
vite-wallet
The Desktop Wallet of Vite
Stars: ✭ 31 (-68.04%)
Mutual labels:  vite
vite-plugin-sass-dts
This is a plugin that automatically creates a type file when using the CSS module type-safely.
Stars: ✭ 20 (-79.38%)
Mutual labels:  vite
Workflow
一个工作流平台
Stars: ✭ 1,888 (+1846.39%)
Mutual labels:  vite

vite-plugin-html-template

HTML template for vite app, like html-webpack-plugin for webpack.

It works perfectly together with vite-plugin-mpa.

wakatime NPM Publish downloads npm version License: MIT

Motivation

  • Vite needs an html entry file, which means we must have
    • projectRoot/index.html for SPA
    • projectRoot/src/pages/*/index.html for MPA
  • Why not use html template for all entries
  • Also we should support ejs/lodash.template syntax for the html content, like setting <title></title>.

Usage

yarn add -D vite-plugin-html-template
// vite.config.ts
import htmlTemplate from 'vite-plugin-html-template'

// @see https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    // ...other plugins
    htmlTemplate(/* options */),
  ],
})

Options

// for SPA, there is nothing to do, just use `public/index.html` as template

// for MPA, customise the template path (default is `public/index.html`) and page title:
{
  // where is the pages' root directory?
  pagesDir: 'src/pages',
  // define pages like it is done in vue-cli
  pages: {
    index: {
      template: './public/index.html',
      title: 'Homepage',
    },
    subpage: {
      template: './src/pages/subpage/index.html',
      title: 'Subpage',
    },
  },
  // expose to template
  data: {
    title: 'Homepage',
  },
}

Underlying

Further

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].