-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Compiled block styles contain a lot of trash #43173
Comments
From my testing this seems to work: const stylesTransform = ( content ) => {
return postcss( [
require( 'cssnano' )( {
preset: [
'default',
{
discardComments: {
removeAll: true,
},
normalizeWhitespace: mode === 'production',
},
],
} ),
] )
.process( content, {
from: 'src/app.css',
to: 'dest/app.css',
} )
.then( ( result ) => result.css );
}; What do you think @gziolo ? |
This is odd. In plugin I see the stylesheets correctly compiled in the Maybe this is an issue with core side transformations. |
When running |
Does it mean that we run CSS processing for usage with WordPress packages in development mode? I don't know that part of the workflow that well so whatever you figure out to fix the issue in core is fine. |
I think we should set |
For some styles, we should keep the comments with licenses when code was copied from other projects. Example: gutenberg/packages/components/src/date-time/date/datepicker.scss Lines 1 to 28 in c416bf8
|
We can use |
Thank you both for the feedback! |
I'm going to close this in favor of the core ticket. |
Reopening this one. The Gutenberg PR on #43177 needs to be merged in order for the tests to stop failing in the Core PR 😅 |
Description
All block styles contain ~75 lines of comments which are not needed. For example you can take a look at https://github.com/WordPress/WordPress/blob/master/wp-includes/blocks/buttons/style.css
These comments get added to all non-minified stylesheets and they don't make any sense.
We should remove comments when these styles are getting compiled.
These files should not be minified, but all comments should still be getting removed.
I think we'll be able to do that by changing this function a bit...
gutenberg/tools/webpack/shared.js
Lines 73 to 94 in eb6b3ff
The result would be smaller styles in the WordPress package, and easier to read/debug source code in pages
The text was updated successfully, but these errors were encountered: