humanmade / humanmade/asset-loader
Introduce an add_editor_style function
- Dominant language
- PHP
- Stars
- 26
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
[`add_editor_style`](https://developer.wordpress.org/reference/functions/add_editor_style/) takes a theme-relative path to a stylesheet, and enqueues that stylesheet as an editor asset. Given that hashed filenames can make it challenging to use editor stylesheets, we should consider introducing a helper method which can take the name of a bundle in the manifest and ensure it gets ingested as an editor stylesheet.
Pseudo-code from #35 which we'd want to wrap in an `Asset_Loader\add_editor_style()` top-level function:
```php
$editor_stylesheet = Asset_Loader\Manifest\get_manifest_resource(
get_theme_file_path( 'dist/production-asset-manifest.json' ),
'tetramino.css'
);
add_editor_style( "dist/$editor_stylesheet" );
```
Contributor guide
Assessment
This issue has not been assessed yet.