@esbuilder/html (original) (raw)
0.0.6 • Public • Published 3 years ago
esbuild HTML Plugin
Plugin that simplifies creation of HTML files to serve your esbuild bundles.
TOC
Usage
Install
yarn
yarn add -D esbuild @esbuilder/html
npm
npm install -D esbuild @esbuilder/html
API
import esbuild from 'esbuild' import { html } from '@esbuilder/html'
// serve mode
await esbuild.serve(
{},
{
entryPoints: ['src/index.html'],
plugins: [
html({
// required in serve mode
serve: true,
/**
* Output filename pattern for src
attribute in script
tag,
* the default value is [name].[hash]
,
* you can override it here.
/
// entryNames: 'js/[name]',
}),
],
outdir: 'dist',
/*
* required for keeping dist/index.html
instead of dist/index.{hash}.html
*/
assetNames: ['[name]'],
},
)
// build mode await esbuild.build({ entryPoints: ['src/index.html'], plugins: [html()], outdir: 'dist', assetNames: ['[name]'], })
Sponsors
1stG | unTS | UnTS |
---|---|---|
Backers
1stG | unTS | UnTS |
---|---|---|
Changelog
Detailed changes for each release are documented in CHANGELOG.md.