Blocks enqueue_assets is loaded everywhere

Support MB Blocks Blocks enqueue_assets is loaded everywhereResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #16118
    SGSG
    Participant

    I have created a custom block which uses

    'enqueue_assets' => function() {
                    wp_enqueue_style( 'glidecss', get_template_directory_uri() . '/blocks/sliderglide/css/glide.min.css', [], '1.0' );
                    wp_enqueue_script( 'glidejs', get_template_directory_uri() . '/blocks/sliderglide/js/glide.min.js', ['jquery'], '1.0', true );
                    wp_enqueue_script( 'glide-launcher', get_template_directory_uri() . '/blocks/sliderglide/js/glide-launcher.js', ['glidejs'], '', true );
                },

    Now the problem is that this is loaded everywhere in the admin area which will results in an error because something is missing: TypeError: this.root is undefined glide.min.js:6:7415

    How can I the resources only on gutenberg enabled admin pages?

    The error prevents other JS to execute properly, for example The MB Builder.

    #16129
    Anh TranAnh Tran
    Keymaster

    Thanks for your feedback. I've just fixed it in version 1.0.7. Please update.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.