@@ -222,22 +222,10 @@ function gutenberg_maybe_inline_styles() {
222222 // Build an array of styles that have a path defined.
223223 foreach ( $ wp_styles ->queue as $ handle ) {
224224 if ( wp_styles ()->get_data ( $ handle , 'path ' ) && file_exists ( $ wp_styles ->registered [ $ handle ]->extra ['path ' ] ) ) {
225- $ block_styles = false ;
226- $ styles_size = filesize ( $ wp_styles ->registered [ $ handle ]->extra ['path ' ] );
227-
228- // Minify styles and get their minified size if SCRIPT_DEBUG is not enabled.
229- if ( ! defined ( 'SCRIPT_DEBUG ' ) || ! SCRIPT_DEBUG ) {
230- // Get the styles and minify them by removing comments & whitespace.
231- $ block_styles = gutenberg_get_minified_styles ( file_get_contents ( $ wp_styles ->registered [ $ handle ]->extra ['path ' ] ) );
232- // Get the styles size.
233- $ styles_size = strlen ( $ block_styles );
234- }
235-
236225 $ styles [] = array (
237226 'handle ' => $ handle ,
238227 'path ' => $ wp_styles ->registered [ $ handle ]->extra ['path ' ],
239- 'size ' => $ styles_size ,
240- 'css ' => $ block_styles ,
228+ 'size ' => filesize ( $ wp_styles ->registered [ $ handle ]->extra ['path ' ] ),
241229 );
242230 }
243231 }
@@ -268,7 +256,7 @@ function( $a, $b ) {
268256 }
269257
270258 // Get the styles if we don't already have them.
271- $ style ['css ' ] = $ style [ ' css ' ] ? $ style [ ' css ' ] : file_get_contents ( $ style ['path ' ] );
259+ $ style ['css ' ] = file_get_contents ( $ style ['path ' ] );
272260
273261 // Set `src` to `false` and add styles inline.
274262 $ wp_styles ->registered [ $ style ['handle ' ] ]->src = false ;
@@ -281,21 +269,6 @@ function( $a, $b ) {
281269}
282270add_action ( 'wp_head ' , 'gutenberg_maybe_inline_styles ' , 1 );
283271
284- /**
285- * Minify styles.
286- *
287- * Removes inline comments and whitespace.
288- *
289- * @param string $styles The styles to be minified.
290- * @return string
291- */
292- function gutenberg_get_minified_styles ( $ styles ) {
293- $ re1 = '(?sx)("(?:[^" \\\\]++| \\\\.)*+"| \'(?:[^ \'\\\\]++| \\\\.)*+ \')|/ \\* (?> .*? \\*/ ) ' ;
294- $ re2 = '(?six)("(?:[^" \\\\]++| \\\\.)*+"| \'(?:[^ \'\\\\]++| \\\\.)*+ \')| \\s*+ ; \\s*+ ( } ) \\s*+| \\s*+ ( [*$~^|]?+= | [{};,>~] | !important \\b ) \\s*+| \\s*([+-]) \\s*(?=[^}]*{)|( [[(:] ) \\s++| \\s++ ( [])] )| \\s+(:)(?![^ \\}]* \\{)|^ \\s++ | \\s++ \\z|( \\s) \\s+ ' ;
295-
296- return preg_replace ( array ( "% {$ re1 }% " , "% {$ re2 }% " ), array ( '$1 ' , '$1$2$3$4$5$6$7$8 ' ), $ styles );
297- }
298-
299272/**
300273 * Complements the implementation of block type `core/social-icon`, whether it
301274 * be provided by core or the plugin, with derived block types for each
0 commit comments