Support » Plugin: Gutenberg Blocks – Ultimate Addons for Gutenberg » Versatile plugin but it loads a LOT of JS even if the blocks are not used

  • I tested the plugin, I “just” wanted a section bloc, didn’t use any of the fancy other blocs that would require JS, the plugin loaded all of the JS :/ Not cool for performance.

    <link rel='stylesheet' id='uagb-slick-css-css'  href='/plugins/ultimate-addons-for-gutenberg/assets/css/slick.css?ver=1.12.4' type='text/css' media='all' />
    <script type='text/javascript' src='/wp-includes/js/jquery/jquery.js?ver=1.12.4'></script>
    <script type='text/javascript' src='/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1'></script>
    <script type='text/javascript' src='/wp-content/plugins/ultimate-addons-for-gutenberg/assets/js/isotope.min.js?ver=1.12.4'></script>
    <script type='text/javascript' src='/wp-content/plugins/ultimate-addons-for-gutenberg/assets/js/imagesloaded.min.js?ver=1.12.4'></script>
    <script type='text/javascript' src='/wp-content/plugins/ultimate-addons-for-gutenberg/assets/js/table-of-contents.js?ver=1.12.4'></script>
    <script type='text/javascript' src='/wp-content/plugins/ultimate-addons-for-gutenberg/assets/js/slick.min.js?ver=1.12.4'></script>
Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Support Team Brainstorm Force


    Hey @inpixelitrust ,

    We value the performance of the website. And we have been constantly working on it.

    In case you want to use just a single block, you can deactivate the rest of the blocks from the UAG admin settings. –

    This does not load the extra JS files.

    I hope that helps you and resolves your problem.

    Vrunda Kansara


    The deactivation of the blocks are for the full site or can be for specific pages?


    Plugin Support Team Brainstorm Force


    Hey @malvino ,

    This is for the entire website.

    Vrunda Kansara

    Is there a way to do that? (Deactivate on specific pages)

    • This reply was modified 3 months, 1 week ago by  malvino.

    Hi! I edited the prior reply, so I’m not sure you have seen it…

    Plugin Support Team Brainstorm Force


    Hi @malvino ,

    > Is there a way to do that? (Deactivate on specific pages)

    There isn’t for now.
    We are constantly working on improvising UAG.
    We will very soon make it page specific. This will allow loading page specific assets for UAG.

    Vrunda Kansara

    Great! Thank you very much!

    Hi @brainstormteam thanks for the reply.

    I’m sorry but no it doesn’t work, here is my local:

    Even if I deactivate all blocs in the settings, as soon as I activate your plugin it forces jQuery, jQuery Migrate + a table of content in the front of the site. My template doesn’t use jQuery I unregistered it.

    Also, if I follow your “just deactivate the blocs” logic, it means that even if I don’t use a bloc but I have it activated, it will still load all the JS for the bloc on pages that don’t use the bloc? Is there no way to avoid that in WordPress. Like “if the bloc is used on the page, load the JS, if not, don’t load it”?



    Hello @brainstormteam,

    WordPress is more in a “Decision not option” way to think plugin enginering.
    But I know how it works with end users as a plugin developer πŸ˜€

    Indeed you’ve got a bug in every ternary operators you make in the file class-uagb-init-blocks.php in the block_assets() method.
    Q: What happen if the block is not set in the $blocks array?
    A: It loads the JS file, because the operator will return true even if the block isn’t set.

    Instead of

    $block_name  = (
        isset( $blocks['block-name'] )
        'disabled' == $blocks['block-name']
    )  ? false : true;

    You should write:

    $block_name  = (
        isset( $blocks['block-name'] )
        && 'disabled' == $blocks['block-name']
    ) || ( 
        ! isset( $blocks['block-name'] )
    ) ? false : true;

    Same later in the if structures.

    Even better : if all the blocks are disabled, you shouldn’t load the CSS file, right?
    To do so do a control on $blocks before enqueueing the file. If the array is empty, don’t load the file πŸ™‚

    Hope this helps.
    Have a good day.

    • This reply was modified 3 months, 1 week ago by  Geoffrey.
    • This reply was modified 3 months, 1 week ago by  Geoffrey. Reason: Formatting the code
    Plugin Support Team Brainstorm Force



    It seems like a bug from our end. The table of contents js file issue has already been reported earlier and we will be fixing it in our next update.

    Also, we will make sure that until and unless the block is used on the page, we won’t be loading their CSS and JS files. I have added this as an improvement at our end and would be fixing in our upcoming releases.

    Your patience is highly appreciated.

    Balachandar Karuparthy

    Plugin Support Team Brainstorm Force



    We have removed the table of contents js file from our plugin in our latest update version 1.12.4.

    We will also soon start working on loading the CSS and JS file only when the block is used.

    We appreciate your patience!

    Balachandar Karuparthy



    That’s a super good news, I will give it another try πŸ™‚

    Plugin Support Team Brainstorm Force


    Hello @inpixelitrust !

    We just wanted to inform you that we’ve been working on the Ultimate Addons and are improving it day by day. πŸ™‚

    Here’s another update – version 1.13.4 we released a few days ago. You might want to take a look at this too!

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this review.