I’ve managed to load app.css
into the editor base on this post:
The style is applied to both editor and front-end after I run yarn build
. However, when I run yarn dev
, the style is only applied to front-end until I run yarn build
again. Presumably, it’s a issue related to how the hot-reload script injects the CSS?
Is there a way to apply the css when I am running yarn dev
?
Other than enabling FSE, the following is the only piece of code added to setup.php
add_action('after_setup_theme', function () {
add_theme_support('editor-styles');
$relAppCssPath = asset('app.css')->relativePath(get_theme_file_path());
add_editor_style($relAppCssPath);
});
app.css
I used for testing
* {
@apply border border-red-500;
}