-
Notifications
You must be signed in to change notification settings - Fork 12k
feat(@angular/cli): add --compress option #4618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,12 +76,13 @@ export const getProdConfig = function (wco: WebpackConfigOptions) { | |
compress: { screw_ie8: true, warnings: buildOptions.verbose }, | ||
sourceMap: buildOptions.sourcemap | ||
}), | ||
new CompressionPlugin({ | ||
asset: '[path].gz[query]', | ||
algorithm: 'gzip', | ||
test: /\.js$|\.html$|\.css$/, | ||
threshold: 10240 | ||
}) | ||
buildOptions.compress ? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be cleaner if a check was done above for @filipesilva thoughts on this? |
||
new CompressionPlugin({ | ||
asset: '[path].gz[query]', | ||
algorithm: 'gzip', | ||
test: /\.js$|\.html$|\.css$/, | ||
threshold: 10240 | ||
}) : (): void => null | ||
].concat(extraPlugins) | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,7 +108,7 @@ export default Task.extend({ | |
stats: statsConfig, | ||
inline: true, | ||
proxy: proxyConfig, | ||
compress: serveTaskOptions.target === 'production', | ||
compress: serveTaskOptions.target === 'production' && serveTaskOptions.compress, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should just be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to make sure, that the compress option will only be available in combination with -t production, but this behavior can be changed in general |
||
watchOptions: { | ||
poll: projectConfig.defaults && projectConfig.defaults.poll | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default here can be removed as it can be set based on build target. This can be done by adding the option values here: https://github.com/angular/angular-cli/blob/master/packages/%40angular/cli/models/webpack-config.ts#L79
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It already is
I disagree, the default value may be redundant here, but is also included in the CLI help output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except the default is false for the development target which makes it misleading in its current form. I know it says production in the description but even a small amount of ambiguity can lead to confusion.
Either way, help should eventually support displaying target specific defaults.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The option will be ignored when -t=development, see https://github.com/angular/angular-cli/blob/master/packages/%40angular/cli/models/webpack-config.ts#L59