accelerator-core
Version:
[](https://travis-ci.org/furkleindustries/accelerator-core)
31 lines (27 loc) • 704 B
JavaScript
import HtmlWebpackPlugin from 'html-webpack-plugin';
import {
paths,
} from '../paths';
// Generates an `index.html` file with the <script> injected.
export const getHtmlPlugin = (mode) => {
const base = {
inject: true,
template: paths.htmlTemplate,
};
const opts = mode === 'development' ? base : {
...base,
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
},
};
return new HtmlWebpackPlugin(opts);
};