0.1.0 • Published 6 years ago

webpack-pug-manifest-plugin v0.1.0

Weekly downloads
24
License
ISC
Repository
github
Last release
6 years ago

Webpack Pug Manifest Plugin

Creates a .pug file with inline script tags for each webpack emitted file. This enables filename-embedded, hash-based caching with pug templates.

Usage

// webpack.config.js
// ...

const WebpackPugManifestPlugin = require('webpack-pug-manifest-plugin');

const pugManifest = new WebpackPugManifestPlugin();

module.exports = {
  entry: {
    bundle1: './src/bundle1',
    bundle2: './src/bundle2'
  },
  output: {
    // ...
    filename: '[name].[chunkhash].js',
    chunkFilename: '[id].[chunkhash].js'
  },
  // ...
  plugins: [pugManifest]
};

Output

// pug-manifest.pug

script(type="text/javascript" src="bundle1.48275ccd1ec5787b0174.js")
script(type="text/javascript" src="bundle2.81f9d53c7o476155833d.js")

Options

Filter

Type: function\ Effect: Filters assets by bundle name (including file extension).

Sort

Type: function\ Effect: Sorts script tags by bundle name. Useful to ensure runtime or vendor bundles are included first, as required by webpack.

License

ISC © TC Schiller