diff --git a/webpack/plugins/htmlPlugin.js b/webpack/plugins/htmlPlugin.js index a13e5df..3a2a4d2 100755 --- a/webpack/plugins/htmlPlugin.js +++ b/webpack/plugins/htmlPlugin.js @@ -1,6 +1,6 @@ const - path = require('path'), - manifest = require('../manifest'), + path = require('path'), + manifest = require('../manifest'), HtmlWebpackPlugin = require('html-webpack-plugin'); const titles = { @@ -25,18 +25,31 @@ const titles = { 'test': 'Test', }; +let minify = { + collapseWhitespace: false, + minifyCSS: false, + minifyJS: false, + removeComments: true, + useShortDoctype: false, +}; + +if (manifest.MINIFY) { + minify = { + collapseWhitespace: true, + minifyCSS: true, + minifyJS: true, + removeComments: true, + useShortDoctype: true, + }; +} + + module.exports = Object.keys(titles).map(title => { return new HtmlWebpackPlugin({ template: path.join(manifest.paths.src, `${title}.html`), path: manifest.paths.build, filename: `${title}.html`, inject: true, - minify: { - collapseWhitespace: true, - minifyCSS: true, - minifyJS: true, - removeComments: true, - useShortDoctype: true, - }, + minify: minify }); });