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

ISBAT use coblocks without jQuery being required by default. (Events block issue) #1361

Closed
stephenheron opened this issue Feb 17, 2020 · 1 comment · Fixed by #1379
Closed
Labels
[Priority] High This issue/pull request needs resolving before the next release [Type] Bug Something that is not working as expected
Milestone

Comments

@stephenheron
Copy link

Describe the bug:

Hi,

I updated coblocks to the latest version (1.21.0) and I noticed that now jQuery appears in the source even when no blocks are being used. Using the previous version that we were using (1.15.0) this was not the case.

I narrowed down the issue to Events block enqueuing 'coblock-slick' (https://github.com/godaddy-wordpress/coblocks/blob/master/src/blocks/events/index.php#L139).

If we compare this to the Posts Carousel block (https://github.com/godaddy-wordpress/coblocks/blob/master/src/blocks/post-carousel/index.php#L322) which also uses Slick, it instead uses 'wp_register_script' and 'editor_script' so it is only included for the editor.

Interestingly in the class-coblocks.block.assets.php it seems it looks for the events block and enqueues the scripts.

To reproduce:

Install coblocks 1.21.0.
View source on page not using any blocks.
jQuery is being included.

Expected behavior:

Install coblocks 1.21.0.
View source on page not using any blocks.
jQuery is not being included.

@stephenheron stephenheron added [Priority] Low This issue/pull request is not immediate [Type] Bug Something that is not working as expected labels Feb 17, 2020
@josephscott
Copy link
Contributor

@jrtashjian this appears to be coming from this change: 950cdb9#diff-2c58a1e4d8686ecb878210a36c71d29dR139

As noted above, CoBlocks now adds extra JS and CSS on every page view, just by activating the plugin. These include:

  • jQuery ( 33 KB )
  • jQuery Migrate ( 4.3 KB )
  • slick.js ( 10.9 KB )
  • coblocks-style.css ( 19.6 KB )

That is an extra 67.8 KB over the wire for every page view, just by activating the CoBlocks plugin.

While #1365 is a good long term solution, not loading these extra resources on every page view would be a big help right now.

@jrtashjian jrtashjian added [Priority] High This issue/pull request needs resolving before the next release and removed [Priority] Low This issue/pull request is not immediate labels Feb 22, 2020
@jrtashjian jrtashjian added this to the Next Release milestone Feb 22, 2020
@AnthonyLedesma AnthonyLedesma linked a pull request Feb 26, 2020 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Priority] High This issue/pull request needs resolving before the next release [Type] Bug Something that is not working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants