CSS: Stop using wp-admin.min.css
and instead queue the individual stylesheets up through load-styles.php
.
We still generate the `wp-admin.*` files for compabitility purposes, however they only include the `@import()` lines. Fixes #35229 git-svn-id: https://develop.svn.wordpress.org/trunk@36341 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e62a20e5b6
commit
834ba4367f
29
Gruntfile.js
29
Gruntfile.js
@ -93,7 +93,7 @@ module.exports = function(grunt) {
|
||||
}
|
||||
]
|
||||
},
|
||||
'wp-admin-rtl': {
|
||||
'wp-admin-css-compat-rtl': {
|
||||
options: {
|
||||
processContent: function( src ) {
|
||||
return src.replace( /\.css/g, '-rtl.css' );
|
||||
@ -102,6 +102,23 @@ module.exports = function(grunt) {
|
||||
src: SOURCE_DIR + 'wp-admin/css/wp-admin.css',
|
||||
dest: BUILD_DIR + 'wp-admin/css/wp-admin-rtl.css'
|
||||
},
|
||||
'wp-admin-css-compat-min': {
|
||||
options: {
|
||||
processContent: function( src ) {
|
||||
return src.replace( /\.css/g, '.min.css' );
|
||||
}
|
||||
},
|
||||
files: [
|
||||
{
|
||||
src: SOURCE_DIR + 'wp-admin/css/wp-admin.css',
|
||||
dest: BUILD_DIR + 'wp-admin/css/wp-admin.min.css'
|
||||
},
|
||||
{
|
||||
src: BUILD_DIR + 'wp-admin/css/wp-admin-rtl.css',
|
||||
dest: BUILD_DIR + 'wp-admin/css/wp-admin-rtl.min.css'
|
||||
}
|
||||
]
|
||||
},
|
||||
version: {
|
||||
options: {
|
||||
processContent: function( src ) {
|
||||
@ -154,7 +171,6 @@ module.exports = function(grunt) {
|
||||
},
|
||||
cssmin: {
|
||||
options: {
|
||||
'wp-admin': ['wp-admin', 'color-picker', 'customize-controls', 'customize-widgets', 'customize-nav-menus', 'ie', 'install', 'login', 'press-this', 'deprecated-*'],
|
||||
compatibility: 'ie7'
|
||||
},
|
||||
core: {
|
||||
@ -163,7 +179,8 @@ module.exports = function(grunt) {
|
||||
dest: BUILD_DIR,
|
||||
ext: '.min.css',
|
||||
src: [
|
||||
'wp-admin/css/{<%= cssmin.options["wp-admin"] %>}.css',
|
||||
'wp-admin/css/*.css',
|
||||
'!wp-admin/css/wp-admin*.css',
|
||||
'wp-includes/css/*.css'
|
||||
]
|
||||
},
|
||||
@ -173,7 +190,8 @@ module.exports = function(grunt) {
|
||||
dest: BUILD_DIR,
|
||||
ext: '.min.css',
|
||||
src: [
|
||||
'wp-admin/css/{<%= cssmin.options["wp-admin"] %>}-rtl.css',
|
||||
'wp-admin/css/*-rtl.css',
|
||||
'!wp-admin/css/wp-admin*.css',
|
||||
'wp-includes/css/*-rtl.css'
|
||||
]
|
||||
},
|
||||
@ -647,7 +665,8 @@ module.exports = function(grunt) {
|
||||
|
||||
grunt.registerTask( 'copy:all', [
|
||||
'copy:files',
|
||||
'copy:wp-admin-rtl',
|
||||
'copy:wp-admin-css-compat-rtl',
|
||||
'copy:wp-admin-css-compat-min',
|
||||
'copy:version'
|
||||
] );
|
||||
|
||||
|
@ -15,7 +15,11 @@ require( ABSPATH . 'wp-admin/includes/noop.php' );
|
||||
require( ABSPATH . WPINC . '/script-loader.php' );
|
||||
require( ABSPATH . WPINC . '/version.php' );
|
||||
|
||||
$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $_GET['load'] );
|
||||
$load = $_GET['load'];
|
||||
if ( is_array( $load ) ) {
|
||||
$load = implode( '', $load );
|
||||
}
|
||||
$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $load );
|
||||
$load = array_unique( explode( ',', $load ) );
|
||||
|
||||
if ( empty($load) )
|
||||
@ -44,6 +48,11 @@ foreach ( $load as $handle ) {
|
||||
continue;
|
||||
|
||||
$style = $wp_styles->registered[$handle];
|
||||
|
||||
if ( empty( $style->src ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$path = ABSPATH . $style->src;
|
||||
|
||||
if ( $rtl && ! empty( $style->extra['rtl'] ) ) {
|
||||
|
@ -249,6 +249,7 @@ if ( isset( $_GET['replytocom'] ) )
|
||||
|
||||
// Login actions
|
||||
add_action( 'login_head', 'wp_print_head_scripts', 9 );
|
||||
add_action( 'login_head', 'print_admin_styles', 9 );
|
||||
add_action( 'login_head', 'wp_site_icon', 99 );
|
||||
add_action( 'login_footer', 'wp_print_footer_scripts', 20 );
|
||||
add_action( 'login_init', 'send_frame_options_header', 10, 0 );
|
||||
|
@ -718,8 +718,24 @@ function wp_default_styles( &$styles ) {
|
||||
$suffix = SCRIPT_DEBUG ? '' : '.min';
|
||||
|
||||
// Admin CSS
|
||||
$styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array( 'open-sans', 'dashicons' ) );
|
||||
$styles->add( 'login', "/wp-admin/css/login$suffix.css", array( 'buttons', 'open-sans', 'dashicons' ) );
|
||||
$styles->add( 'common', "/wp-admin/css/common$suffix.css" );
|
||||
$styles->add( 'forms', "/wp-admin/css/forms$suffix.css" );
|
||||
$styles->add( 'admin-menu', "/wp-admin/css/admin-menu$suffix.css" );
|
||||
$styles->add( 'dashboard', "/wp-admin/css/dashboard$suffix.css" );
|
||||
$styles->add( 'list-tables', "/wp-admin/css/list-tables$suffix.css" );
|
||||
$styles->add( 'edit', "/wp-admin/css/edit$suffix.css" );
|
||||
$styles->add( 'revisions', "/wp-admin/css/revisions$suffix.css" );
|
||||
$styles->add( 'media', "/wp-admin/css/media$suffix.css" );
|
||||
$styles->add( 'themes', "/wp-admin/css/themes$suffix.css" );
|
||||
$styles->add( 'about', "/wp-admin/css/about$suffix.css" );
|
||||
$styles->add( 'nav-menus', "/wp-admin/css/nav-menus$suffix.css" );
|
||||
$styles->add( 'widgets', "/wp-admin/css/widgets$suffix.css" );
|
||||
$styles->add( 'site-icon', "/wp-admin/css/site-icon$suffix.css" );
|
||||
$styles->add( 'l10n', "/wp-admin/css/l10n$suffix.css" );
|
||||
|
||||
$styles->add( 'wp-admin', false, array( 'common', 'forms', 'admin-menu', 'dashboard', 'list-tables', 'edit', 'revisions', 'media', 'themes', 'about', 'nav-menus', 'widgets', 'site-icon', 'l10n', 'open-sans', 'dashicons' ) );
|
||||
|
||||
$styles->add( 'login', "/wp-admin/css/login$suffix.css", array( 'buttons', 'forms', 'l10n', 'open-sans', 'dashicons' ) );
|
||||
$styles->add( 'install', "/wp-admin/css/install$suffix.css", array( 'buttons', 'open-sans' ) );
|
||||
$styles->add( 'wp-color-picker', "/wp-admin/css/color-picker$suffix.css" );
|
||||
$styles->add( 'customize-controls', "/wp-admin/css/customize-controls$suffix.css", array( 'wp-admin', 'colors', 'ie', 'imgareaselect' ) );
|
||||
@ -761,7 +777,9 @@ function wp_default_styles( &$styles ) {
|
||||
// RTL CSS
|
||||
$rtl_styles = array(
|
||||
// wp-admin
|
||||
'wp-admin', 'install', 'wp-color-picker', 'customize-controls', 'customize-widgets', 'customize-nav-menus', 'ie', 'login', 'press-this',
|
||||
'common', 'forms', 'admin-menu', 'dashboard', 'list-tables', 'edit', 'revisions', 'media', 'themes', 'about', 'nav-menus',
|
||||
'widgets', 'site-icon', 'l10n', 'install', 'wp-color-picker', 'customize-controls', 'customize-widgets', 'customize-nav-menus',
|
||||
'ie', 'login', 'press-this',
|
||||
// wp-includes
|
||||
'buttons', 'admin-bar', 'wp-auth-check', 'editor-buttons', 'media-views', 'wp-pointer',
|
||||
'wp-jquery-ui-dialog',
|
||||
@ -1100,6 +1118,7 @@ function print_late_styles() {
|
||||
return;
|
||||
}
|
||||
|
||||
script_concat_settings();
|
||||
$wp_styles->do_concat = $concatenate_scripts;
|
||||
$wp_styles->do_footer_items();
|
||||
|
||||
@ -1134,10 +1153,14 @@ function _print_styles() {
|
||||
if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP )
|
||||
$zip = 'gzip';
|
||||
|
||||
if ( !empty($wp_styles->concat) ) {
|
||||
if ( $concat = trim( $wp_styles->concat, ', ' ) ) {
|
||||
$dir = $wp_styles->text_direction;
|
||||
$ver = $wp_styles->default_version;
|
||||
$href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&load=" . trim($wp_styles->concat, ', ') . '&ver=' . $ver;
|
||||
|
||||
$concat = str_split( $concat, 128 );
|
||||
$concat = 'load%5B%5D=' . implode( '&load%5B%5D=', $concat );
|
||||
|
||||
$href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&" . $concat . '&ver=' . $ver;
|
||||
echo "<link rel='stylesheet' href='" . esc_attr($href) . "' type='text/css' media='all' />\n";
|
||||
|
||||
if ( !empty($wp_styles->print_code) ) {
|
||||
@ -1167,7 +1190,7 @@ function script_concat_settings() {
|
||||
|
||||
if ( ! isset($concatenate_scripts) ) {
|
||||
$concatenate_scripts = defined('CONCATENATE_SCRIPTS') ? CONCATENATE_SCRIPTS : true;
|
||||
if ( ! is_admin() || ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) )
|
||||
if ( ( ! is_admin() && ! did_action( 'login_init' ) ) || ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) )
|
||||
$concatenate_scripts = false;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ function login_header( $title = 'Log In', $message = '', $wp_error = '' ) {
|
||||
<title><?php bloginfo('name'); ?> › <?php echo $title; ?></title>
|
||||
<?php
|
||||
|
||||
wp_admin_css( 'login', true );
|
||||
wp_enqueue_style( 'login' );
|
||||
|
||||
/*
|
||||
* Remove all stored post data on logging out.
|
||||
@ -87,6 +87,7 @@ function login_header( $title = 'Log In', $message = '', $wp_error = '' ) {
|
||||
* @since 3.1.0
|
||||
*/
|
||||
do_action( 'login_enqueue_scripts' );
|
||||
|
||||
/**
|
||||
* Fires in the login page header after scripts are enqueued.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user