Skip to content

Commit

Permalink
feat(build): minify/optimize component stylesheets (#4259)
Browse files Browse the repository at this point in the history
  • Loading branch information
clydin authored and hansl committed Jan 30, 2017
1 parent 335ab5f commit 499ef2f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"chalk": "^1.1.3",
"common-tags": "^1.3.1",
"css-loader": "^0.26.1",
"cssnano": "^3.10.0",
"debug": "^2.1.3",
"denodeify": "^1.2.1",
"diff": "^2.2.2",
Expand Down Expand Up @@ -81,7 +82,6 @@
"opn": "4.0.1",
"ora": "^0.2.0",
"portfinder": "1.0.9",
"postcss-discard-comments": "^2.0.4",
"postcss-loader": "^0.9.1",
"raw-loader": "^0.5.1",
"reflect-metadata": "^0.1.8",
Expand Down
1 change: 0 additions & 1 deletion packages/angular-cli/models/webpack-configs/production.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const getProdConfig = function (wco: WebpackConfigOptions) {
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.LoaderOptionsPlugin({ minimize: true }),
new webpack.optimize.UglifyJsPlugin(<any>{
mangle: { screw_ie8: true },
compress: { screw_ie8: true, warnings: buildOptions.verbose },
Expand Down
7 changes: 4 additions & 3 deletions packages/angular-cli/models/webpack-configs/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
import { extraEntryParser, getOutputHashFormat } from './utils';
import { WebpackConfigOptions } from '../webpack-config';

const postcssDiscardComments = require('postcss-discard-comments');
const cssnano = require('cssnano');
const autoprefixer = require('autoprefixer');
const ExtractTextPlugin = require('extract-text-webpack-plugin');

Expand Down Expand Up @@ -38,9 +38,10 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
// https://github.com/webpack-contrib/style-loader#recommended-configuration
const cssSourceMap = buildOptions.extractCss && buildOptions.sourcemap;

// discard comments in production
// minify/optimize css in production
// autoprefixer is always run separately so disable here
const extraPostCssPlugins = buildOptions.target === 'production'
? [postcssDiscardComments]
? [cssnano({ safe: true, autoprefixer: false })]
: [];

// determine hashing format
Expand Down
2 changes: 1 addition & 1 deletion packages/angular-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"chalk": "^1.1.3",
"common-tags": "^1.3.1",
"css-loader": "^0.26.1",
"cssnano": "^3.10.0",
"debug": "^2.1.3",
"denodeify": "^1.2.1",
"diff": "^2.2.2",
Expand Down Expand Up @@ -68,7 +69,6 @@
"opn": "4.0.1",
"ora": "^0.2.0",
"portfinder": "1.0.9",
"postcss-discard-comments": "^2.0.4",
"postcss-loader": "^0.9.1",
"raw-loader": "^0.5.1",
"remap-istanbul": "^0.6.4",
Expand Down

0 comments on commit 499ef2f

Please sign in to comment.