Support

Account

Home Forums ACF PRO ACF Blocks with block.json generates wrong CSS file URL in editor Reply To: ACF Blocks with block.json generates wrong CSS file URL in editor

  • OK… well, no one here seems to have anything else to say about this, but just in case a future ACF PRO user encounters this same issue, I’ve found a workaround.

    Using the "file:./whatever.css" value still never works for me in the editor (though it’s fine on the front end), but I’ve discovered that registering the script/style first, then registering the block and using the handle in block.json works.

    So for example, wherever you’re registering the whatever block, you’d have these lines:

    wp_register_style('whatever-css', get_theme_file_uri('blocks/whatever/whatever.css'));
    register_block_type(get_theme_file_path('blocks/whatever'));

    And then in your whatever block’s block.json file, you’d have this:

    "style": "whatever-css",

    It works!