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

View File

@ -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 */