mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-04 20:54:29 +00:00
Editor: Remove unnecessary CSS comments from compiled styles.
Props aristath, adamsilverstein, SergeyBiryukov, gziolo. Fixes #56388. git-svn-id: https://develop.svn.wordpress.org/trunk@55193 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -57,16 +57,21 @@ const baseConfig = ( env ) => {
|
||||
};
|
||||
|
||||
const stylesTransform = ( mode ) => ( content ) => {
|
||||
if ( mode === 'production' ) {
|
||||
return postcss( [
|
||||
require( 'cssnano' )( {
|
||||
preset: 'default',
|
||||
} ),
|
||||
] )
|
||||
.process( content, { from: 'src/app.css', to: 'dest/app.css' } )
|
||||
.then( ( result ) => result.css );
|
||||
}
|
||||
return content;
|
||||
return postcss( [
|
||||
require( 'cssnano' )( {
|
||||
preset: mode === 'production' ? 'default' : [
|
||||
'default',
|
||||
{
|
||||
discardComments: {
|
||||
removeAll: ! content.includes( 'Copyright' ) && ! content.includes( 'License' ),
|
||||
},
|
||||
normalizeWhitespace: false,
|
||||
},
|
||||
],
|
||||
} ),
|
||||
] )
|
||||
.process( content, { from: 'src/app.css', to: 'dest/app.css' } )
|
||||
.then( ( result ) => result.css );
|
||||
};
|
||||
|
||||
const normalizeJoin = ( ...paths ) => join( ...paths ).replace( /\\/g, '/' );
|
||||
|
||||
Reference in New Issue
Block a user