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.
"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
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
block.json file, you’d have this:
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!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 18, 2023
© 2023 Advanced Custom Fields.