Automattic / Automattic/default-small-business-theme
Editor styles: Redundant enqueuing of editor styles
- Dominant language
- SCSS
- Stars
- 10
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
I mentioned this during Business Elegant's review, but right now the editor styles are enqueued two different ways into the new block editor:
This method is standard, and I think a bit more predictable: https://github.com/Automattic/default-small-business-theme/blob/master/functions.php#L192-L199 It links the stylesheet, as is, to the page.
This method is actually intended for existing TinyMCE stylesheets in older themes (like Twenty Seventeen): https://github.com/Automattic/default-small-business-theme/blob/master/functions.php#L75-L76 So it's basically expecting stylesheets that only reference HTML elements (`h1`, `table`), and maybe some classes like `.gallery`.
The second method embeds the styles in the head of the page, prefixed with the class `.editor-styles-wrapper`. This makes these styles a lot more "powerful" and overridy than they would be enqueued in the first method. Because of that, when this is updated some careful testing will be needed, to make sure those styles still work as expected.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in functions.php at lines 75-76 and 192-199, where the two editor-style enqueuing methods are referenced. Compare their effects in the block editor and test the stylesheet after retaining the standard method; done means styles remain correct without redundant enqueuing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scss
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100