From 98a62074ad7ed0f3050cc70fcae58b40a470dd4c Mon Sep 17 00:00:00 2001 From: squidfunk Date: Fri, 17 May 2019 21:38:04 +0200 Subject: [PATCH] Added banner to compiled files and minify SVGs --- webpack.config.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 52c20ad17..d98354351 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -199,8 +199,15 @@ module.exports = (_env, args) => { // eslint-disable-line complexity from: "**/*.html", transform: content => { const metadata = require(path.resolve(__dirname, "package.json")) - return html.minify(content.toString(), { + const banner = + `{#-\n` + + ` This file was automatically generated - do not edit\n` + + `-#}\n` + return banner + html.minify(content.toString(), { collapseBooleanAttributes: true, + collapseWhitespace: true, + collapseInlineTagWhitespace: false, + conservativeCollapse: false, includeAutoGeneratedTags: false, minifyCSS: true, minifyJS: true, @@ -282,17 +289,12 @@ module.exports = (_env, args) => { // eslint-disable-line complexity /* Minify images */ new ImageminPlugin({ test: /\.(ico|png|svg)$/i, - svgo: null - // Hack: Temporarily disabled, as SVGO removes the viewbox property - // and setting the plugin to false doesn't have any effect. - // { - // plugins: [ - // { - // cleanupIDs: false, - // removeViewBox: false - // } - // ] - // } + svgo: { + plugins: [ + { cleanupIDs: false }, + { removeViewBox: false } + ] + } }), /* Write manifest */