Make WordPress Core

Changeset 48096


Ignore:
Timestamp:
06/19/2020 10:06:28 PM (6 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Gruntfile.js

    r48075 r48096  
    10321032                                                {
    10331033                                                        match: /\/\/ START: emoji arrays[\S\s]*\/\/ END: emoji arrays/g,
    1034                                                         replacement: function () {
     1034                                                        replacement: function() {
    10351035                                                                var regex, files,
    10361036                                                                        partials, partialsSet,
     
    10581058
    10591059                                                                // Sort the entities list by length, so the longest emoji will be found first.
    1060                                                                 emojiArray = entities.split( '\n' ).sort( function ( a, b ) {
     1060                                                                emojiArray = entities.split( '\n' ).sort( function( a, b ) {
    10611061                                                                        return b.length - a.length;
    10621062                                                                } );
     
    10981098                                        }
    10991099                                ]
     1100                        },
     1101                        emojiBannerText: {
     1102                                options: {
     1103                                        patterns: [
     1104                                                {
     1105                                                        match: new RegExp( '\\s*' + BANNER_TEXT.replace( /[\/\*\!]/g, '\\$&' ) ),
     1106                                                        replacement: ''
     1107                                                }
     1108                                        ]
     1109                                },
     1110                                files: [
     1111                                        {
     1112                                                expand: true,
     1113                                                flatten: true,
     1114                                                src: [
     1115                                                        BUILD_DIR + 'wp-includes/formatting.php'
     1116                                                ],
     1117                                                dest: BUILD_DIR + 'wp-includes/'
     1118                                        }
     1119                                ]
    11001120                        }
    11011121                },
     
    14201440                                'includes:emoji',
    14211441                                'includes:embed',
     1442                                'replace:emojiBannerText'
    14221443                        ] );
    14231444                }
Note: See TracChangeset for help on using the changeset viewer.