Support

Account

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

  • I have the same code and it works for me. The js file appears in the footer (back-end/gutenberg and front-end). Maybe try this:

    
    function my_init() {
    
            wp_register_style( 'team', get_template_directory_uri() . '/dist/blocks/css/team.css', array(), filemtime( get_template_directory() . '/dist/blocks/css/team.css' ), 'all' );
            wp_register_script( 'team', get_template_directory_uri() . '/dist/blocks/js/team.js', array( 'jquery', 'application' ), filemtime( get_template_directory() . '/dist/blocks/js/team.js' ), true );
    }
    add_action('init', 'my_init');
    
    // acf_register_block_type:
    'enqueue_assets'    => function () {
            wp_enqueue_style( 'team' );
            wp_enqueue_script( 'team' );
          },