1.0.6 • Published 5 years ago

html-webpack-replace-assets-plugin v1.0.6

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

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
1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago