html-webpack-replace-assets-plugin

1.0.6 • Public • Published

html-webpack-replace-assets-plugin

Build Status npm package npm downloads

A plugin to help webpack concat js and inject into html

Why

Webpack is really powerful. However, when I want to change the asset files and inject into html without webpack JSONP code wrapper, it seems impossible to do that without other tool's help.

Install

npm install html-webpack-replace-assets-plugin --save-dev

Features

  • replace assets path when inject to html(with html-webpack-plugin)

Usage

const HtmlWebpackReplaceAssetsPlugin = require('html-webpack-replace-assets-plugin');

new HtmlWebpackReplaceAssetsPlugin({
  ...see options
  // examples
  convert(asset, path) {
    // asset: webpack asset object
    // path: asset path
    return path.replace('.js', `${asset.size()}.js.gz`);
  }
});

Options

convert [Function] default: (asset, path) => name

assets path(or name) transformer

TODO

  • [ ] add css support

Readme

Keywords

none

Package Sidebar

Install

npm i html-webpack-replace-assets-plugin

Weekly Downloads

31

Version

1.0.6

License

ISC

Unpacked Size

7.91 kB

Total Files

7

Last publish

Collaborators

  • maoquan