diff --git a/Gruntfile.js b/Gruntfile.js index eb5c6d7be9..f4436f2ded 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -464,6 +464,19 @@ module.exports = function(grunt) { BUILD_DIR + 'wp-includes/js/tinymce/plugins/*/plugin.min.js' ], dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js' + }, + emoji: { + options: { + separator: '\n', + process: function( src, filepath ) { + return '// Source: ' + filepath.replace( BUILD_DIR, '' ) + '\n' + src; + } + }, + src: [ + BUILD_DIR + 'wp-includes/js/twemoji.min.js', + BUILD_DIR + 'wp-includes/js/wp-emoji.min.js' + ], + dest: BUILD_DIR + 'wp-includes/js/wp-emoji-release.min.js' } }, compress: { @@ -502,6 +515,12 @@ module.exports = function(grunt) { dest: SOURCE_DIR } }, + includes: { + emoji: { + src: BUILD_DIR + 'wp-includes/formatting.php', + dest: '.' + } + }, _watch: { all: { files: [ @@ -615,6 +634,8 @@ module.exports = function(grunt) { 'concat:tinymce', 'compress:tinymce', 'clean:tinymce', + 'concat:emoji', + 'includes:emoji', 'jsvalidate:build' ] ); diff --git a/package.json b/package.json index ae3b09cda4..17f74a8b9d 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "grunt-contrib-qunit": "~0.5.2", "grunt-contrib-uglify": "~0.8.0", "grunt-contrib-watch": "~0.6.1", + "grunt-includes": "~0.4.5", "grunt-jsvalidate": "~0.2.2", "grunt-legacy-util": "^0.2.0", "grunt-patch-wordpress": "~0.3.0", diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php index 69905be1c3..449d971cb8 100644 --- a/src/wp-includes/default-filters.php +++ b/src/wp-includes/default-filters.php @@ -213,6 +213,7 @@ add_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 ); add_action( 'wp_head', 'locale_stylesheet' ); add_action( 'publish_future_post', 'check_and_publish_future_post', 10, 1 ); add_action( 'wp_head', 'noindex', 1 ); +add_action( 'wp_head', 'print_emoji_detection_script', 7 ); add_action( 'wp_head', 'wp_print_styles', 8 ); add_action( 'wp_head', 'wp_print_head_scripts', 9 ); add_action( 'wp_head', 'wp_generator' ); diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index f14ef866db..6a3a66e7af 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -4082,6 +4082,13 @@ function wp_spaces_regexp() { * @since 4.2.0 */ function print_emoji_styles() { + static $printed = false; + + if ( $printed ) { + return; + } + + $printed = true; ?>