Script Loader: Pass the suffix to package style handles to ensure correct file names for minified RTL stylesheets.

Props ocean90.

Merges [44231] into trunk.

See #45547.

git-svn-id: https://develop.svn.wordpress.org/trunk@44314 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2018-12-18 23:24:07 +00:00
parent 156a01e8fb
commit 3c836e3181

View File

@ -1921,9 +1921,54 @@ function wp_default_styles( &$styles ) {
$styles->add( 'colors-fresh', false, array( 'wp-admin', 'buttons' ) ); // Old handle.
$styles->add( 'open-sans', $open_sans_font_url ); // No longer used in core as of 4.6
// Packages styles
$fonts_url = '';
/*
* Translators: Use this to specify the proper Google Font name and variants
* to load that is supported by your language. Do not translate.
* Set to 'off' to disable loading.
*/
$font_family = _x( 'Noto Serif:400,400i,700,700i', 'Google Font Name and Variants' );
if ( 'off' !== $font_family ) {
$fonts_url = 'https://fonts.googleapis.com/css?family=' . urlencode( $font_family );
}
$styles->add( 'wp-editor-font', $fonts_url );
$styles->add( 'wp-block-library-theme', "/wp-includes/css/dist/block-library/theme$suffix.css" );
$styles->add(
'wp-edit-blocks',
"/wp-includes/css/dist/block-library/editor$suffix.css",
array(
'wp-components',
'wp-editor',
'wp-block-library',
// Always include visual styles so the editor never appears broken.
'wp-block-library-theme',
)
);
$package_styles = array(
'block-library' => array(),
'components' => array(),
'edit-post' => array( 'wp-components', 'wp-editor', 'wp-edit-blocks', 'wp-block-library', 'wp-nux' ),
'editor' => array( 'wp-components', 'wp-editor-font', 'wp-nux' ),
'format-library' => array(),
'list-reusable-blocks' => array( 'wp-components' ),
'nux' => array( 'wp-components' ),
);
foreach ( $package_styles as $package => $dependencies ) {
$handle = 'wp-' . $package;
$path = "/wp-includes/css/dist/$package/style$suffix.css";
$styles->add( $handle, $path, $dependencies );
}
// RTL CSS
$rtl_styles = array(
// wp-admin
// Admin CSS
'common',
'forms',
'admin-menu',
@ -1946,7 +1991,7 @@ function wp_default_styles( &$styles ) {
'customize-preview',
'ie',
'login',
// wp-includes
// Includes CSS
'buttons',
'admin-bar',
'wp-auth-check',
@ -1954,7 +1999,17 @@ function wp_default_styles( &$styles ) {
'media-views',
'wp-pointer',
'wp-jquery-ui-dialog',
// deprecated
// Package styles
'wp-block-library-theme',
'wp-edit-blocks',
'wp-block-library',
'wp-components',
'wp-edit-post',
'wp-editor',
'wp-format-library',
'wp-list-reusable-blocks',
'wp-nux',
// Deprecated CSS
'deprecated-media',
'farbtastic',
);
@ -1965,54 +2020,6 @@ function wp_default_styles( &$styles ) {
$styles->add_data( $rtl_style, 'suffix', $suffix );
}
}
// Packages styles
$fonts_url = '';
/*
* Translators: Use this to specify the proper Google Font name and variants
* to load that is supported by your language. Do not translate.
* Set to 'off' to disable loading.
*/
$font_family = _x( 'Noto Serif:400,400i,700,700i', 'Google Font Name and Variants' );
if ( 'off' !== $font_family ) {
$fonts_url = 'https://fonts.googleapis.com/css?family=' . urlencode( $font_family );
}
$styles->add( 'wp-editor-font', $fonts_url );
$styles->add( 'wp-block-library-theme', "/wp-includes/css/dist/block-library/theme$suffix.css" );
$styles->add_data( 'wp-block-library-theme', 'rtl', 'replace' );
$styles->add(
'wp-edit-blocks',
"/wp-includes/css/dist/block-library/editor$suffix.css",
array(
'wp-components',
'wp-editor',
'wp-block-library',
// Always include visual styles so the editor never appears broken.
'wp-block-library-theme',
)
);
$styles->add_data( 'wp-edit-blocks', 'rtl', 'replace' );
$package_styles = array(
'block-library' => array(),
'components' => array(),
'edit-post' => array( 'wp-components', 'wp-editor', 'wp-edit-blocks', 'wp-block-library', 'wp-nux' ),
'editor' => array( 'wp-components', 'wp-editor-font', 'wp-nux' ),
'format-library' => array(),
'list-reusable-blocks' => array( 'wp-components' ),
'nux' => array( 'wp-components' ),
);
foreach ( $package_styles as $package => $dependencies ) {
$handle = 'wp-' . $package;
$path = "/wp-includes/css/dist/$package/style$suffix.css";
$styles->add( $handle, $path, $dependencies );
$styles->add_data( $handle, 'rtl', 'replace' );
}
}
/**