# esbuild-plugin-html **Repository Path**: we_coder/esbuild-plugin-html ## Basic Information - **Project Name**: esbuild-plugin-html - **Description**: 基于ejs模板引擎esbuild模板插件 - **Primary Language**: TypeScript - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-02-09 - **Last Updated**: 2023-03-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 使用ejs作为模板引擎的esbuild html模板插件 ## 安装 `npm install -D @fallen_leaves/esbuild-plugin-html` ## 使用 如果设置`format: 'esm'`, js文件会以``模式加载 ```js // esbuild.config.js import { build } from 'esbuild' import esbuildPluginHtml from '@fallen_leaves/esbuild-plugin-html' build({ entryPoints: ['src/main.js'], outfile: 'output/static/main.js', format: 'iife', // 'esm' bundle: true, sourcemap: true, plugins: [ esbuildPluginHtml({ template: 'public/index.html', minify: true, compile: true, filename: 'output/index.html', renderData: { title: 'title' }, publicPath: './' }) ] }) ``` ## 配置项 ### `template` `Type: String` `Default: .....` html模板字符串或者模板文件绝对路径,支持ejs语法。例如: ```js // 1.文件路径 esbuildPluginHtml({ template: 'public/index.html' }) // 2.模板字符串 esbuildPluginHtml({ template: `