From 8bfdd80f469c966ac32f6f97b899c389f0778f1c Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 6 Dec 2021 10:12:28 +0000 Subject: [PATCH] Build/Test Tools: Remove the `replace:emoji-banner-text` Grunt task. The task was previously used to ensure that `/*! This file is auto-generated */` comment is not included on front end as part of the inline emoji detection script. As the `wp-emoji-loader.js` script is now included via `file_get_contents()` and `wp_print_inline_script_tag()` instead of `grunt-include` to simplify the logic, the task does not find anything to replace and is no longer necessary. Additionally, include a line break before the `wp-emoji-loader.js` script content for better line wrapping. Follow-up to [48096], [50651], [52132]. See #44632, #44306, #53363. git-svn-id: https://develop.svn.wordpress.org/trunk@52325 602fd350-edb4-49c9-b593-d223f7449a82 --- Gruntfile.js | 21 --------------------- src/wp-includes/formatting.php | 2 +- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 7eef7cda9a..3c936b1179 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1093,26 +1093,6 @@ module.exports = function(grunt) { } ] }, - 'emoji-banner-text': { - options: { - patterns: [ - { - match: new RegExp( '\\s*' + BANNER_TEXT.replace( /[\/\*\!]/g, '\\$&' ) ), - replacement: '' - } - ] - }, - files: [ - { - expand: true, - flatten: true, - src: [ - BUILD_DIR + 'wp-includes/formatting.php' - ], - dest: BUILD_DIR + 'wp-includes/' - } - ] - }, 'source-maps': { options: { patterns: [ @@ -1583,7 +1563,6 @@ module.exports = function(grunt) { 'build:files', 'build:js', 'build:css', - 'replace:emoji-banner-text', 'replace:source-maps', 'verify:build' ] ); diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index 5a135f0f0e..9c8b71cfbf 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -5787,7 +5787,7 @@ function _print_emoji_detection_script() { } wp_print_inline_script_tag( - sprintf( 'window._wpemojiSettings = %s;', wp_json_encode( $settings ) ) . + sprintf( 'window._wpemojiSettings = %s;', wp_json_encode( $settings ) ) . "\n" . file_get_contents( sprintf( ABSPATH . WPINC . '/js/wp-emoji-loader' . wp_scripts_get_suffix() . '.js' ) ) ); }