Skip to content

Commit

Permalink
feat(@angular/cli): add support for minifying HTML
Browse files Browse the repository at this point in the history
Close #1861
  • Loading branch information
ishitatsuyuki authored and filipesilva committed Jun 7, 2017
1 parent b94b901 commit 75311c2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/@angular/cli/models/webpack-configs/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ export function getBrowserConfig(wco: WebpackConfigOptions) {
filename: path.resolve(buildOptions.outputPath, appConfig.index),
chunksSortMode: packageChunkSort(appConfig),
excludeChunks: lazyChunks,
xhtml: true
xhtml: true,
minify: buildOptions.target === 'production' ? {
caseSensitive: true,
collapseWhitespace: true,
keepClosingSlash: true
} : false
}),
new BaseHrefWebpackPlugin({
baseHref: buildOptions.baseHref
Expand Down

3 comments on commit 75311c2

@CharlBest
Copy link

@CharlBest CharlBest commented on 75311c2 Jun 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @filipesilva does minifying HTML files specifically the index.html on production builds still work in version 6+?

I ran my site through https://developers.google.com/speed/pagespeed/insights and it suggested to minify my HTML. So that's how I ended up here.

image

PS: it's so cool how so many of these best practices and enhancement the CLI does out of the box for you. Thanks for that!

@filipesilva
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, as far as I can tell it's been removed in 6.x because of some incompatibilities we had with plugins. We hope to re-add it in the future.

@CharlBest
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok cool. Thanks

Please sign in to comment.