Build/Test Tools: Replace the banner text from `wp-emoji-loader.min.js` in `formatting.php` during build process.
This ensures that `/*! This file is auto-generated */` comment is not included on front end as part of the inline Emoji detection script. Follow-up to [41271], [46589]. Props superpoincare, SergeyBiryukov. Fixes #49861. git-svn-id: https://develop.svn.wordpress.org/trunk@48096 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
82cfc3f62d
commit
44def76306
25
Gruntfile.js
25
Gruntfile.js
|
@ -1031,7 +1031,7 @@ module.exports = function(grunt) {
|
||||||
patterns: [
|
patterns: [
|
||||||
{
|
{
|
||||||
match: /\/\/ START: emoji arrays[\S\s]*\/\/ END: emoji arrays/g,
|
match: /\/\/ START: emoji arrays[\S\s]*\/\/ END: emoji arrays/g,
|
||||||
replacement: function () {
|
replacement: function() {
|
||||||
var regex, files,
|
var regex, files,
|
||||||
partials, partialsSet,
|
partials, partialsSet,
|
||||||
entities, emojiArray;
|
entities, emojiArray;
|
||||||
|
@ -1057,7 +1057,7 @@ module.exports = function(grunt) {
|
||||||
entities = entities.replace( /-/g, '' );
|
entities = entities.replace( /-/g, '' );
|
||||||
|
|
||||||
// Sort the entities list by length, so the longest emoji will be found first.
|
// Sort the entities list by length, so the longest emoji will be found first.
|
||||||
emojiArray = entities.split( '\n' ).sort( function ( a, b ) {
|
emojiArray = entities.split( '\n' ).sort( function( a, b ) {
|
||||||
return b.length - a.length;
|
return b.length - a.length;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
@ -1097,6 +1097,26 @@ module.exports = function(grunt) {
|
||||||
dest: SOURCE_DIR + 'wp-includes/'
|
dest: SOURCE_DIR + 'wp-includes/'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
emojiBannerText: {
|
||||||
|
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/'
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_watch: {
|
_watch: {
|
||||||
|
@ -1419,6 +1439,7 @@ module.exports = function(grunt) {
|
||||||
'build:css',
|
'build:css',
|
||||||
'includes:emoji',
|
'includes:emoji',
|
||||||
'includes:embed',
|
'includes:embed',
|
||||||
|
'replace:emojiBannerText'
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
Loading…
Reference in New Issue