With latest roots/acorn
release version 2.1.1
the assets now have a relativePath()
function, which simplifies this code a lot:
namespace App;
use function Roots\asset;
add_action('after_setup_theme', function () {
// Add frontend styles as editor styles
// Must be added by relative path (not remote URI)
// (@see https://core.trac.wordpress.org/ticket/55728#ticket)
$relCssPath = asset('app.css')->relativePath(get_theme_file_path());
add_editor_style($relCssPath);
});