2.2.1 • Published 5 years ago

webpack-html-generator-plugin v2.2.1

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

webpack-html-generator-plugin

A webpack plugin to generate html for each entry

Install

# var npm
npm i -D webpack-html-generator-plugin

# var yarn
yarn add -D webpack-html-generator-plugin

Quick Start

Generate a html entry for each entrypoint to include all script & style files, use default template.

// webpack.config.ts
import { HtmlGeneratorPlugin } from './src/index'

// multiple entries
const entries = {
  admin: './src/admin.ts',
  pc: './src/web.ts',
}

export default {
  entry: entries,
  output: {
    path: process.cwd() + '/dist',
  },
  plugins: [
    new HtmlGeneratorPlugin(/* options */)
  ],
}

Options

import { SMap } from 'monofile-utilities/lib/map'

export type TemplateFunction = (data: { data: HtmlInput }) => string

export interface HtmlInput {
  htmlClass?: string;
  title?: string;
  keywords?: string;
  description?: string;
  head?: string;
  links?: string;
  bodyClass?: string;
  header?: string;
  content?: string;
  scripts?: string;
  footer?: string;
  template?: TemplateFunction;
}

export interface WebpackHtmlGeneratorPluginOptions extends HtmlInput {
  filename?: string;
  compress?: boolean;
  entries?: SMap<HtmlInput | false>;
}

Licence

MIT

2.2.1

5 years ago

2.2.0

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.0.0

6 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago