File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
packages/@angular/cli/models/webpack-configs Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -47,8 +47,16 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
47
47
const deployUrl = wco . buildOptions . deployUrl || '' ;
48
48
49
49
const postcssPluginCreator = function ( ) {
50
+ // safe settings based on: https://github.com/ben-eb/cssnano/issues/358#issuecomment-283696193
51
+ const importantCommentRe = / @ p r e s e r v e | @ l i c e n s e | [ @ # ] \s * s o u r c e (?: M a p p i n g ) ? U R L | ^ ! / i;
52
+ const minimizeOptions = {
53
+ autoprefixer : false , // full pass with autoprefixer is run separately
54
+ safe : true ,
55
+ mergeLonghand : false , // version 3+ should be safe; cssnano currently uses 2.x
56
+ discardComments : { remove : ( comment : string ) => ! importantCommentRe . test ( comment ) }
57
+ } ;
58
+
50
59
return [
51
- autoprefixer ( ) ,
52
60
postcssUrl ( {
53
61
url : ( URL : string ) => {
54
62
// Only convert root relative URLs, which CSS-Loader won't process into require().
@@ -69,9 +77,10 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
69
77
return `/${ baseHref } /${ deployUrl } /${ URL } ` . replace ( / \/ \/ + / g, '/' ) ;
70
78
}
71
79
}
72
- } )
80
+ } ) ,
81
+ autoprefixer ( ) ,
73
82
] . concat (
74
- minimizeCss ? [ cssnano ( { safe : true , autoprefixer : false } ) ] : [ ]
83
+ minimizeCss ? [ cssnano ( minimizeOptions ) ] : [ ]
75
84
) ;
76
85
} ;
77
86
( postcssPluginCreator as any ) [ postcssArgs ] = {
You can’t perform that action at this time.
0 commit comments