#57536 closed enhancement (fixed)
Add support for global styles custom css
Reported by: | glendaviesnz | Owned by: | flixos90 |
---|---|---|---|
Milestone: | 6.2 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Editor | Keywords: | has-patch gutenberg-merge has-unit-tests commit |
Focuses: | rest-api, performance | Cc: |
Description
In the Gutenberg repo, a feature has been merged that allows custom CSS to be added to Global Styles via the style editor, in a similar way to how the Customizer allows the addition of custom CSS.
In order to support this a number of PHP file changes need to be ported from the Gutenberg plugin.
For further context, the Gutenberg PR that introduced this feature is: https://github.com/WordPress/gutenberg/pull/46141/
Change History (17)
This ticket was mentioned in PR #3896 on WordPress/wordpress-develop by @glendaviesnz.
21 months ago
#1
- Keywords has-patch added; needs-patch removed
@glendaviesnz commented on PR #3896:
21 months ago
#2
Still draft as need to look at also bringing across changes from https://github.com/WordPress/wordpress-develop/pull/3896, and also adding some tests
@glendaviesnz commented on PR #3896:
20 months ago
#4
@aristath - I have updated this to match the changes merged in with https://github.com/WordPress/gutenberg/pull/47396, which will affect https://github.com/WordPress/wordpress-develop/pull/3925 also
@glendaviesnz commented on PR #3896:
20 months ago
#5
@Mamaduka have pulled across https://github.com/WordPress/gutenberg/pull/47062, but some unit tests are failing on multisite which may be related to this and I ran out of time to work out why - will take another look tomorrow if you don't have time to look at it.
@Mamaduka commented on PR #3896:
20 months ago
#6
@glendaviesnz, I was able to resolve failing multisite tests by granting capabilities to admin users.
I added the following to WP_REST_Global_Styles_Controller_Test::wpSetupBeforeClass
{{{php
if ( is_multisite() ) {
grant_super_admin( self::$admin_id );
}
}}}
@Mamaduka commented on PR #3896:
20 months ago
#8
@glendaviesnz, we should probably place the grant_super_admin
part of the code after $admin_id
is assigned.
#9
@
20 months ago
- Focuses rest-api added
- Keywords changes-requested added
Changes are requested for the patch PR 3896.
#10
@
20 months ago
- Focuses performance added
Adding performance
keyword for caching added into wp_get_global_styles_custom_css()
. cc @flixos90.
@glendaviesnz commented on PR #3896:
20 months ago
#11
Thanks @felixarntz and @hellofromtonya for the detailed feedback!
@glendaviesnz commented on PR #3896:
20 months ago
#12
@hellofromtonya I have run the suggested tests, re load-styles.php
:
Step 1: Added the following constants to wp-config.php:
define( 'CONCATENATE_SCRIPTS', true ); define( 'WP_DEBUG', false ); define( 'SCRIPT_DEBUG', false );
Step 2: Applied this PR
Step 3: Started localhost environment with
npm install npm run build:dev npm run env:start npm run env:install
Step 4: Logged in and opened the WP Admin area.
✅No fatal error occured
✅The load-styles.css stylesheet loaded
✅Navigated through screens and no fatal error occured
@hellofromTonya commented on PR #3896:
20 months ago
#13
I think (correct me if I'm wrong) this PR is good shape for commit.
- The concern @felixarntz and I had has been tested to validate it's not a concern ✅
- All feedback (minus a too long to read inline comment request) has been addressed 💹
- Open questions have been addressed ✅
Is there anything else pending before commit? @glendaviesnz @dream-encode @felixarntz?
If no, could the committers please approve for confirmation? 🙇
#14
@
20 months ago
- Keywords commit added; changes-requested removed
- Owner changed from glendaviesnz to flixos90
- Status changed from assigned to reviewing
Planning to commit this shortly.
@flixos90 commented on PR #3896:
20 months ago
#16
Committed in https://core.trac.wordpress.org/changeset/55192
@glendaviesnz commented on PR #3896:
20 months ago
#17
Thanks @felixarntz, @hellofromtonya and @dream-encode !
Trac ticket: https://core.trac.wordpress.org/ticket/57536