Skip to content
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

Fix loading of style.css inside the editor #108

Merged
merged 1 commit into from
Jun 29, 2020

Conversation

johngodley
Copy link
Member

The previous change to render_callback meant that style.css didn’t load inside the editor (no blocks are rendered).

Go back to using the normal style param when registering the block, and let Gutenberg decide when to load the style

Fixes #103

The previous change to `render_callback` meant that `style.css` didn’t load inside the editor (no blocks are rendered).

Go back to using the normal `style` param when registering the block, and let Gutenberg decide when to load the style
@johngodley johngodley merged commit 331a247 into master Jun 29, 2020
@johngodley johngodley deleted the fix/grid-editor-styles branch June 29, 2020 11:13
@simison
Copy link
Member

simison commented Jun 29, 2020

Does the style still load on frontend only when the block is rendered? :-)

Alternatively you could @import frontend style to the editor style file.

@simison
Copy link
Member

simison commented Jun 29, 2020

FYI @Automattic/ganon would be good to check if template API still needs D45267-code

@johngodley
Copy link
Member Author

Does the style still load on frontend only when the block is rendered

This change makes it load style.css the standard Gutenberg style loading route.

would be good to check if template API still needs D45267-code

It won't affect that, which refers to front.css, which is only loaded when the block is rendered.

@simison
Copy link
Member

simison commented Jun 29, 2020

Does the style still load on frontend only when the block is rendered

This change makes it load style.css the standard Gutenberg style loading route.

Right, that's been problematic for performance on .com and reason why it was changed in first place here. :-) Imagine if every WordPress page would load CSS+JS for every block ever shipped on .com. We don't have this problem on Jetpack for example because we use combination of sass imports and render_callback

@johngodley
Copy link
Member Author

problematic for performance on .com and reason why it was changed in first place here

It was specifically front.css that is a problem for the grid block as this is a non-standard file, and is of a significant size.

Imagine if every WordPress page would load CSS+JS for every block ever shipped on .com

Sure, I get that, and it affects every site not just those on WordPress.com. Gutenberg is working on this (WordPress/gutenberg#22754) so the situation will hopefully improve.

With this change we are in a better performing position than the block has been in from the start (i.e. front.css is still optionally loaded), and the editor is now fixed (the reason for making this change).

It may not be the most performant position, but this will be improved in future work.

@simison
Copy link
Member

simison commented Jun 29, 2020

Thanks for elaborating! :-)

@andrewserong
Copy link
Member

would be good to check if template API still needs D45267-code

Just to be sure, I tried testing the endpoint with that diff reverted, and it looks like we still need it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Layout Grid: Missing Outermost Gutters in Editor
3 participants