Make WordPress Core

Changeset 43329


Ignore:
Timestamp:
06/01/2018 01:28:53 AM (7 years ago)
Author:
pento
Message:

Build Tools: grunt build should only copy Core files.

Historically, grunt build has copied all files from the src directory to the build directory. This is usually fine, but can be super slow when there are lots of custom plugins or themes in the src directory.

To rectify this, we now only copy Core plugins and themes to build.

Props adamsilverstein, pento, johnbillion.
Fixes #44256.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Gruntfile.js

    r43327 r43329  
    1212        BANNER_TEXT = '/*! This file is auto-generated */',
    1313        autoprefixer = require( 'autoprefixer' ),
    14         phpUnitWatchGroup = grunt.option( 'group' );
     14        phpUnitWatchGroup = grunt.option( 'group' ),
     15        buildFiles = [
     16            '*.php',
     17            '*.txt',
     18            '*.html',
     19            'wp-includes/**', // Include everything in wp-includes.
     20            'wp-admin/**', // Include everything in wp-admin.
     21            'wp-content/index.php',
     22            'wp-content/themes/index.php',
     23            'wp-content/themes/twenty*/**',
     24            'wp-content/plugins/index.php',
     25            'wp-content/plugins/hello.php',
     26            'wp-content/plugins/akismet/**'
     27        ],
     28        cleanFiles = [];
     29
     30    buildFiles.forEach( function( buildFile ) {
     31        cleanFiles.push( BUILD_DIR + buildFile );
     32    } );
    1533
    1634    if ( 'watch:phpunit' === grunt.cli.tasks[ 0 ] && ! phpUnitWatchGroup ) {
     
    83101        },
    84102        clean: {
    85             all: [BUILD_DIR],
     103            plugins: [BUILD_DIR + 'wp-content/plugins'],
     104            themes: [BUILD_DIR + 'wp-content/themes'],
     105            all: cleanFiles,
    86106            js: [BUILD_DIR + 'wp-admin/js/', BUILD_DIR + 'wp-includes/js/'],
    87107            dynamic: {
     
    112132                        expand: true,
    113133                        cwd: SOURCE_DIR,
    114                         src: [
    115                             '**',
     134                        src: buildFiles.concat( [
    116135                            '!js/**', // JavaScript is extracted into separate copy tasks.
    117                             '!**/.{svn,git}/**', // Ignore version control directories.
     136                            '!.{svn,git}', // Exclude version control folders.
    118137                            '!wp-includes/version.php', // Exclude version.php
    119138                            '!index.php', '!wp-admin/index.php',
    120139                            '!_index.php', '!wp-admin/_index.php'
    121                         ],
     140                        ] ),
    122141                        dest: BUILD_DIR
    123142                    },
Note: See TracChangeset for help on using the changeset viewer.