1.0.1 • Published 8 years ago

html-file-webpack-plugin v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
8 years ago

Html File Webpack Plugin

This is an extension plugin that injects webpack assets source to html for the webpack plugin html-webpack-plugin.

本插件的作用是把webpack的产物的源码注入到html中,需配合 html-webpack-plugin 使用。

Installation

$ npm install --save-dev html-file-webpack-plugin html-webpack-plugin

Usage

Require the plugin in your webpack config:

var HtmlFilePlugin = require('html-file-webpack-plugin');

Add the plugin to your webpack config as follows:

plugins: [
    new HtmlWebpackPlugin(),
    new HtmlFilePlugin({
        filename: 'manifest.json'
    })
]

Add the plugin to your html as follows:

<script>
window.webpackManifest=<%=htmlWebpackPlugin.files.htmlFilePlugin['manifest.json']%>
</script>

The file (manifest.json) will be add to htmlWebpackPlugin.files.htmlFilePlugin.

Configuration

filename: string | [] The file to be injected to html.