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

Code overhead #25092

Closed
Sven74Muc opened this issue Sep 5, 2020 · 8 comments
Closed

Code overhead #25092

Sven74Muc opened this issue Sep 5, 2020 · 8 comments
Labels
[Type] Discussion For issues that are high-level and not yet ready to implement.

Comments

@Sven74Muc
Copy link

Sven74Muc commented Sep 5, 2020

Gutenberg is developing in the direction of elementor and other page builder with huge code overhead.

  1. Many many div layers in code, much more I would write by hand
  2. All scripts (css and js) is loaded everytime. Google Lighthouse reports this as unused code.
    2.1 All blocks are loaded while I just use half of them on my site. There is no posibility to deactivate unused blocks
    2.2 There is no need to load all active blocks on all pages and posts. The block information needs to be loaded dynamicly otherwise Wordpress gets a performance issue!

I installed "Disable Gutenberg Blocks - Block Manager" today... a plugin which isn't updated since 2 years!!! :-(
This plugin alows me to unload 80 blocks!!! Most are the embeded blocks for Twitter, Video, Youtube, etc. I just need 3 of this huge list.
Such a functionality needs to be within the Wordpress / Gutenberg core... much more detailed than this plugin.

So Gutenberg is growing and growing my page site and load time. At the moment it is on a level where it could be handled, but the direction Gutenberg is growing will be the death of Gutenberg.

@talldan
Copy link
Contributor

talldan commented Sep 8, 2020

@Sven74Muc I'm not really sure I can comment on your first point. There's certainly shouldn't be a need for extra divs in all but a few cases.

I know the group block has one, which is a point of frustration now that templates are being built using it. There's an issue here for that - #20376, but if there are others in core blocks that you feel are not needed, definitely point them out.

For your second point, there are ongoing discussions about asynchronous loading of block assets. As far as I know it's a desired feature, but not straightforward. See this issue, which while old is still actively being discussed - #2768

So Gutenberg is growing and growing my page site and load time.

This shouldn't be the case as the JavaScript for static blocks isn't loaded on the front end (only in the editor), and dynamic blocks are generally rendered server-side.

@talldan talldan added the [Type] Discussion For issues that are high-level and not yet ready to implement. label Sep 8, 2020
@Sven74Muc
Copy link
Author

@talldan Thanks for your answer

Have you had a look at the mentioned plugin. With this, PHP Everywhere (as only one block add-on) and css simple I'm able to reduce the code. This requires much manual coding and loading inividual css coad on each page / post.
This is workking for me, but can't be the direction to use for the normal Wordpress user.

@talldan
Copy link
Contributor

talldan commented Sep 16, 2020

@Sven74Muc I'm not sure what you mean when you refer to 'reducing the code'.

Why? What problems are you facing that require this?

@Sven74Muc
Copy link
Author

Reducing code is for speed optimization which i needed for the site visitor experience as well as for SEO.
That's why I deleted Elementor forr example.

@talldan
Copy link
Contributor

talldan commented Sep 17, 2020

As mentioned in my previous response, the majority of blocks are not 'loaded' for site visitors. The way static blocks work is that they save HTML to your database when a post is saved in the editor. When a visitor visits that post the HTML from the database is retrieved and displayed. None of the JavaScript for those blocks is loaded for visitors so there is no overhead.

Dynamic blocks (like archive, latest post) are slightly different, when a visitor visits these blocks might perform some server-side computation like fetching the latest posts from the database and then incorporating them into the site HTML, but again no JavaScript is generally loaded.

Some third party blocks may differ, but they're an exception rather than the rule.

I think most of your points have been answered, and there are other issues covering the topics, so I'll close this issue now.

@talldan talldan closed this as completed Sep 17, 2020
@Tropicalista
Copy link

I think he's referring to css and js of core bocks. In a simple blank page with some text you don't need to load all css library, for example all css related to gallery, social links, cover image and so on. And I agree with him, the only css/js loaded should be the one needed from that page.

@talldan
Copy link
Contributor

talldan commented Oct 15, 2020

@Tropicalista I think everyone agrees it'd be a great feature, but not straightforward in implementation in any way. I recommend commenting on #2768 though if you want to have input.

And just to mention again, blocks rarely have any front-end JavaScript assets. None of the core blocks do as far as I'm aware. This seems to be a bit of a misconception when people hear that the block editor is mostly JavaScript based, so it'd be good to dispel illusions.

The CSS assets also shouldn't be huge, front-end related styles should be loading only.

@Tropicalista
Copy link

Just for clarify, I'm not saying CSS assets it's huge, I'm saying it's useless to load css that it's actually not needed on the page. I will check the #2768.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Discussion For issues that are high-level and not yet ready to implement.
Projects
None yet
Development

No branches or pull requests

3 participants