Skip to content

Commit

Permalink
Added banner to compiled files and minify SVGs
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed May 17, 2019
1 parent b36a725 commit 98a6207
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 98a6207

Please sign in to comment.