Make WordPress Core

Ticket #31911: 31911.2.patch

File 31911.2.patch, 2.0 KB (added by iseulde, 10 years ago)
  • Gruntfile.js

     
    525525                        all: {
    526526                                files: [
    527527                                        SOURCE_DIR + '**',
     528                                        '!' + SOURCE_DIR + 'wp-includes/js/media/**',
    528529                                        // Ignore version control directories.
    529530                                        '!' + SOURCE_DIR + '**/.{svn,git}/**'
    530531                                ],
     
    540541                                        SOURCE_DIR + 'wp-includes/js/media/*.js',
    541542                                        '!' + SOURCE_DIR + 'wp-includes/js/media/*.manifest.js'
    542543                                ],
    543                                 tasks: ['uglify:media']
     544                                tasks: ['copy:dynamic'],
     545                                options: {
     546                                        spawn: false
     547                                }
    544548                        },
    545549                        config: {
    546550                                files: 'Gruntfile.js'
     
    663667        // Default task.
    664668        grunt.registerTask('default', ['build']);
    665669
    666         // Add a listener to the watch task.
    667         //
    668         // On `watch:all`, automatically updates the `copy:dynamic` and `clean:dynamic`
    669         // configurations so that only the changed files are updated.
    670         // On `watch:rtl`, automatically updates the `rtlcss:dynamic` configuration.
    671         grunt.event.on('watch', function( action, filepath, target ) {
    672                 if ( target !== 'all' && target !== 'rtl' ) {
     670        /*
     671         * Automatically updates the `:dynamic` configurations
     672         * so that only the changed files are updated.
     673         */
     674        grunt.event.on( 'watch', function( action, filepath, target ) {
     675                var src;
     676
     677                if ( [ 'all', 'rtl', 'browserify' ].indexOf( target ) === -1 ) {
    673678                        return;
    674679                }
    675680
    676                 var relativePath = path.relative( SOURCE_DIR, filepath ),
    677                         cleanSrc = ( action === 'deleted' ) ? [relativePath] : [],
    678                         copySrc = ( action === 'deleted' ) ? [] : [relativePath];
    679 
    680                 grunt.config(['clean', 'dynamic', 'src'], cleanSrc);
    681                 grunt.config(['copy', 'dynamic', 'src'], copySrc);
    682                 grunt.config(['rtlcss', 'dynamic', 'src'], copySrc);
    683         });
     681                src = [ path.relative( SOURCE_DIR, filepath ) ];
     682
     683                if ( action === 'deleted' ) {
     684                        grunt.config( [ 'clean', 'dynamic', 'src' ], src );
     685                } else {
     686                        grunt.config( [ 'copy', 'dynamic', 'src' ], src );
     687
     688                        if ( target === 'rtl' ) {
     689                                grunt.config( [ 'rtlcss', 'dynamic', 'src' ], src );
     690                        }
     691                }
     692        } );
    684693};