Sage 10 \Roots\asset() vs Sage 9 asset_path()

In Sage 9.0.10 :

Using:
add_editor_style(asset_path('styles/tinymce.css'));

asset_path(‘styles/tinymce.css’) would output:
http://lorem.test/wp-content/themes/my-theme/dist/styles/tinymce_e8ca3004.css


But in Sage 10.3.1 (Bud 6.4.5):

Using:

$asset = \Roots\asset(‘css/tinymce.css’);
add_editor_style($asset->uri());

\Roots\asset(‘css/tinymce.css’) will output:
http://lorem.test/wp-content/themes/my-theme/public/css/tinymce.css

Which leads to the file not being found, because the generated file is called: tinymce.fcb963.css

How can this be solved / What am I missing ?

Unfortunately, your link isn’t helpful.
The problem I’m facing comes from \Roots\asset(‘’) IMO.

You are right, the filename indicates that these styles should be used for the TinyMCE (Classic) editor.

When that tinymce.css is from an entrypoint (in the bud.config.mjs, entry()),
you don’t add the styles/ directory, but rather just use its entrypoint name (+ .css):

\Roots\asset('tinymce.css')
3 Likes

Thank you for help ! This indeed solves it. :pray:
I assumed specifying a directory would be required.