0.1.0 • Published 6 years ago

html-plugin v0.1.0

Weekly downloads
7
License
Unlicense
Repository
github
Last release
6 years ago

HTML Plugin

Here is the plugin mentioned in the offcial webpack guide.

build status coverage npm dependencies

This plugin aims to create index.html for PWAs, with good default template built-in, and let you customize with simple configuration.

You can also provide your own templates in the same way you compose apps - JSX and React components.

Installation

Install the plugin with npm:

$ npm i -D html-plugin vhtml

Usage

Add the plugin to webpack config:

+ const HtmlPlugin = require('html-plugin')
  module.exports = {
    entry: 'index.js',
    output: {
      path: __dirname + '/dist',
      filename: 'bundle.js'
    },
+   plugins: [
+     new HtmlPlugin({
+       title: 'My App'
+     })
+   ]
  }

This will generate dist/index.html:

<!DOCTYPE html>
<html lang="en">

<head>
  <title>My App</title>
  <meta charset="utf-8" />
  <meta name="mobile-web-app-capable" content="yes" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta name="theme-color" content="#000" />
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  <link rel="manifest" href="/manifest.json" />
  <link rel="shortcut icon" href="/favicon.png" />
</head>

<body>
  <div id="root"></div>
  <script src="bundle.js"></script>
</body>

</html>

Options

  • filename
  • title / name
  • lang
  • themeColor
  • manifest
  • favicon
0.1.0

6 years ago

0.0.6

6 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago