Added banner to compiled files and minify SVGs

This commit is contained in:
squidfunk 2019-05-17 21:38:04 +02:00
parent b36a725d30
commit 98a62074ad
1 changed files with 14 additions and 12 deletions

View File

@ -199,8 +199,15 @@ module.exports = (_env, args) => { // eslint-disable-line complexity
from: "**/*.html", from: "**/*.html",
transform: content => { transform: content => {
const metadata = require(path.resolve(__dirname, "package.json")) 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, collapseBooleanAttributes: true,
collapseWhitespace: true,
collapseInlineTagWhitespace: false,
conservativeCollapse: false,
includeAutoGeneratedTags: false, includeAutoGeneratedTags: false,
minifyCSS: true, minifyCSS: true,
minifyJS: true, minifyJS: true,
@ -282,17 +289,12 @@ module.exports = (_env, args) => { // eslint-disable-line complexity
/* Minify images */ /* Minify images */
new ImageminPlugin({ new ImageminPlugin({
test: /\.(ico|png|svg)$/i, test: /\.(ico|png|svg)$/i,
svgo: null svgo: {
// Hack: Temporarily disabled, as SVGO removes the viewbox property plugins: [
// and setting the plugin to false doesn't have any effect. { cleanupIDs: false },
// { { removeViewBox: false }
// plugins: [ ]
// { }
// cleanupIDs: false,
// removeViewBox: false
// }
// ]
// }
}), }),
/* Write manifest */ /* Write manifest */