Archived topic
Enqueue / preview issue
3 replies · Started by Mike on October 2, 2020
Hi
We're using GP and have built a custom slider Gutenberg block which uses Swiper js. It works fine on the front end but in the Gutenberg editor we get a "this block has encountered an error and cannot be previewed" message when previewing - which we think is because the page can't find the swiper.js script. No matter what we do we can't seem to get the enqueue to put the swiper js in the head.
I wondered if there is anything in GP which we should be aware of which forces script references into the footer - or any tips as to how we might approach this issue? There seems very little on the web to help us!
Thanks in advance
Mike
Hi there,
That error is usually because of a syntax error in the javascript that renders the block. A missing JS file shouldn't trigger it.
For more details on the error, right-click + Inspect the page and look at the Console tab - the editor will give you more info on what's going on.
Thanks Tom!
No problem!