0.0.0 • Published 2 years ago

@esbuildr/html v0.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

TOC

Usage

Install

# yarn
yarn add -D esbuild @esbuildr/html

# npm
npm install -D esbuild @esbuildr/html

API

import esbuild from 'esbuild'
import { html } from '@esbuildr/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]'],
})
<!-- src/index.html -->
<!DOCTYPE html>
<html>
  <head>
    <!-- ... -->
  </head>
  <body>
    <script src="index.ts"></script>
  </body>
</html>

Sponsors

1stGRxTSUnTS
1stG Open Collective backers and sponsorsRxTS Open Collective backers and sponsorsUnTS Open Collective backers and sponsors

Backers

1stGRxTSUnTS
1stG Open Collective backers and sponsorsRxTS Open Collective backers and sponsorsUnTS Open Collective backers and sponsors

Changelog

Detailed changes for each release are documented in CHANGELOG.md.

License

MIT © JounQin@1stG.me