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) {
4747 const deployUrl = wco . buildOptions . deployUrl || '' ;
4848
4949 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+
5059 return [
51- autoprefixer ( ) ,
5260 postcssUrl ( {
5361 url : ( URL : string ) => {
5462 // Only convert root relative URLs, which CSS-Loader won't process into require().
@@ -69,9 +77,10 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
6977 return `/${ baseHref } /${ deployUrl } /${ URL } ` . replace ( / \/ \/ + / g, '/' ) ;
7078 }
7179 }
72- } )
80+ } ) ,
81+ autoprefixer ( ) ,
7382 ] . concat (
74- minimizeCss ? [ cssnano ( { safe : true , autoprefixer : false } ) ] : [ ]
83+ minimizeCss ? [ cssnano ( minimizeOptions ) ] : [ ]
7584 ) ;
7685 } ;
7786 ( postcssPluginCreator as any ) [ postcssArgs ] = {
You can’t perform that action at this time.
0 commit comments