jaketrent / html-webpack-template

a better default template for html-webpack-plugin
MIT License
830 stars 139 forks source link

Why so much white space? #40

Closed Sotorin closed 7 years ago

Sotorin commented 7 years ago

Why is there so much white space in resulting HTML?

screen shot 2017-01-06 at 4 22 47 pm
BrandonBoone commented 7 years ago

This is likely due to all of the optional blocks within index.ejs. When options aren't used/skipped you can get some significant whitespace. Also, it looks like all white space in the template is preserved even if the line just contains ejs syntax. It may be interesting to see if the file could be compressed at the end of processing.

oomathias commented 7 years ago

You can add this inside your config to remove them:

new HtmlWebpackPlugin({
  minify: {
    collapseWhitespace: true,
    preserveLineBreaks: true,
  },
  ...
})
jaketrent commented 7 years ago

@oomathias Thanks for the HtmlWebpackPlugin option comment. Closing.