Home › Forums › Gutenberg › Gutenberg ACF Blocks – JS Not Working/Loading in Editor/Preview › Reply To: Gutenberg ACF Blocks – JS Not Working/Loading in Editor/Preview
The issue is no JS files are being loaded from the blocks. The CSS is being loaded for example when viewing page source I see:
<link rel='stylesheet' id='testimonials-css' href='http://enosix.localhost/wp-content/themes/enosix/dist/blocks/css/testimonials.css?ver=1627702841' media='all' />
But there is no JS file. So that’s the issue. Does anyone have an example of working JS in the preview? It would seem that
'enqueue_assets' => function () {
wp_enqueue_style( 'team', get_template_directory_uri() . '/dist/blocks/css/team.css', array(), filemtime( get_template_directory() . '/dist/blocks/css/team.css' ), 'all' );
wp_enqueue_script( 'team', get_template_directory_uri() . '/dist/blocks/js/team.js', array( 'jquery', 'application' ), filemtime( get_template_directory() . '/dist/blocks/js/team.js' ), true );
},
Is not working for JS.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.