- This topic has 1 reply, 2 voices, and was last updated 1 year, 4 months ago by .
-
Topic
-
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 Meta Box Builder.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.