Bud build development & asset() function

Hi, I would like to ask if there is yarn build development in bud v5.8? It seems yarn build development is not working in v5.8?

Or is there a way on how to get the css files using asset() function? I tried to use asset() function to enqueue the css in add_editor_style. It seems works when using yarn build but when I used yarn dev, the asset() function cannot find the editor.css because the editor.css was merged to editor.js.

/*
 * Add editor styles
 */
add_action( 'init', function(){
    add_editor_style( asset('editor.js')->uri() );
});

Note that for Gutenberg the editor styles needs to be added by relative path, see this example

(related trac issue #55728 (baseURL missing for remotely fetched editor styles) – WordPress Trac)

1 Like

Not necessarily, you can also provide a URL (if reachable): WordPress/block-editor.php at 1a21c14d857a0d85d44794d871add3dbdab88d5b · WordPress/WordPress · GitHub

@nlemoine: The issue is not that the styles are not loaded, but rather that the URLs aren’t rewritten during CSS post-processing in Gutenberg, resulting in broken references.