0.0.14 • Published 6 years ago

html-webpack-mountpoint-plugin v0.0.14

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

html-webpack-mountpoint-plugin

This is a naive utility that adds application mount points to the default html template provided by html-webpack-plugin (use with webpack4)

Basic Usage

to install:

  • npm i html-webpack-mountpoint-plugin --save-dev
    or
  • yarn add html-webpack-mountpoint-plugin -D

webpack.config.js

const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackMountpointPlugin = require('html-webpack-mountpoint-plugin');
...
{
  plugins: [
    new HtmlWebpackPlugin({
      title: 'WebpackMountpointTest',
      <options>
    }),
    new HtmlWebpackMountpointPlugin({
      tagName: 'section',
      mountPoints: ['app-hook', 'dialogs-hook']
    }) ...

    or

    new HtmlWebpackMountpointPlugin([
      {
        tagName: 'section',
        id: 'app-hook',
        attributes: {
          className: 'spa mount'
        }
      },
      {
        tagName: 'div',
        id: 'dialogs-hook',
        attributes: {
          className: 'too-cool'
        }
      },
    ])
  ], ...
}

produces: index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>WebpackMountpointTest</title>
  </head>
  <body>
    <section id="app-hook"></section>
    <section id="dialogs-hook"></section>
    <script type="text/javascript" src="src.bundle.js"></script>
  </body>
  <!--  or  -->
  <body>
    <section id="app-hook" class="spa mount"></section>
    <div id="dialogs-hook" class="too-cool"></div>
    <script type="text/javascript" src="src.bundle.js"></script>
  </body>
</html>

Please post any issues or feature requests to https://github.com/AdamAtri/html-webpack-mountpoint-plugin/issues

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago