From d2ca4ad8365a119b4c8d39fcfa000057ad8b93b8 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Fri, 16 Nov 2018 00:22:27 +0000 Subject: [PATCH] Build Tools: Minify the package CSS when building. CSS coming from the `@wordpress` packages wasn't being minified in the build. This had the noteable side effect of causing RTL CSS to not be loaded when `SCRIPT_DEBUG` was set to `false`. Props websupporter. See #45330. git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43905 602fd350-edb4-49c9-b593-d223f7449a82 --- Gruntfile.js | 10 ++++++++++ src/wp-includes/script-loader.php | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 01e4f66053..803ded4c5c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -199,6 +199,15 @@ module.exports = function(grunt) { 'wp-includes/js/mediaelement/wp-mediaelement.css' ] }, + dist: { + expand: true, + cwd: BUILD_DIR, + dest: BUILD_DIR, + ext: '.min.css', + src: [ + 'wp-includes/css/dist/*/*.css' + ] + }, rtl: { expand: true, cwd: BUILD_DIR, @@ -939,6 +948,7 @@ module.exports = function(grunt) { 'usebanner', 'webpack:prod', 'webpack:devProdTarget', + 'cssmin:dist', 'jsvalidate:build' ] ); diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index e9b6aac530..821823a8fe 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -1675,12 +1675,12 @@ function wp_default_styles( &$styles ) { } $styles->add( 'wp-editor-font', $fonts_url ); - $styles->add( 'wp-block-library-theme', '/wp-includes/css/dist/block-library/theme.css' ); + $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.css', + "/wp-includes/css/dist/block-library/editor$suffix.css", array( 'wp-components', 'wp-editor', @@ -1702,7 +1702,7 @@ function wp_default_styles( &$styles ) { foreach ( $package_styles as $package => $dependencies ) { $handle = 'wp-' . $package; - $path = '/wp-includes/css/dist/' . $package . '/style.css'; + $path = "/wp-includes/css/dist/$package/style$suffix.css"; $styles->add( $handle, $path, $dependencies ); $styles->add_data( $handle, 'rtl', 'replace' );