Make WordPress Core

Changeset 33960


Ignore:
Timestamp:
09/09/2015 02:11:23 AM (9 years ago)
Author:
wonderboymusic
Message:

Speed up browserify builds, don't uglify the media builds on watch.

Props iseulde.
Fixes #31911.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Gruntfile.js

    r33959 r33960  
    535535                files: [
    536536                    SOURCE_DIR + '**',
     537                    '!' + SOURCE_DIR + 'wp-includes/js/media/**',
    537538                    // Ignore version control directories.
    538539                    '!' + SOURCE_DIR + '**/.{svn,git}/**'
     
    550551                    '!' + SOURCE_DIR + 'wp-includes/js/media/*.manifest.js'
    551552                ],
    552                 tasks: ['browserify']
     553                tasks: ['browserify', 'copy:dynamic'],
     554                options: {
     555                    spawn: false
     556                }
    553557            },
    554558            config: {
     
    671675    grunt.registerTask('default', ['build']);
    672676
    673     // Add a listener to the watch task.
    674     //
    675     // On `watch:all`, automatically updates the `copy:dynamic` and `clean:dynamic`
    676     // configurations so that only the changed files are updated.
    677     // On `watch:rtl`, automatically updates the `rtlcss:dynamic` configuration.
     677    /*
     678     * Automatically updates the `:dynamic` configurations
     679     * so that only the changed files are updated.
     680     */
    678681    grunt.event.on('watch', function( action, filepath, target ) {
    679         if ( target !== 'all' && target !== 'rtl' ) {
     682        var src;
     683
     684        if ( [ 'all', 'rtl', 'browserify' ].indexOf( target ) === -1 ) {
    680685            return;
    681686        }
    682687
    683         var relativePath = path.relative( SOURCE_DIR, filepath ),
    684             cleanSrc = ( action === 'deleted' ) ? [relativePath] : [],
    685             copySrc = ( action === 'deleted' ) ? [] : [relativePath];
    686 
    687         grunt.config(['clean', 'dynamic', 'src'], cleanSrc);
    688         grunt.config(['copy', 'dynamic', 'src'], copySrc);
    689         grunt.config(['rtlcss', 'dynamic', 'src'], copySrc);
     688        src = [ path.relative( SOURCE_DIR, filepath ) ];
     689        if ( action === 'deleted' ) {
     690            grunt.config( [ 'clean', 'dynamic', 'src' ], src );
     691        } else {
     692            grunt.config( [ 'copy', 'dynamic', 'src' ], src );
     693
     694            if ( target === 'rtl' ) {
     695                grunt.config( [ 'rtlcss', 'dynamic', 'src' ], src );
     696            }
     697        }
    690698    });
    691699};
Note: See TracChangeset for help on using the changeset viewer.