humanmade / humanmade/asset-loader

Introduce an add_editor_style function

Open
#32 3 comments 1 reaction 0 assignees View on GitHub
help wanted
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.