Make WordPress Core

Ticket #36528: 36528.diff

File 36528.diff, 1.4 KB (added by jorbin, 9 years ago)
  • Gruntfile.js

     
    668668                grunt.task.run( '_' + this.nameArgs );
    669669        } );
    670670
    671         grunt.registerTask( 'precommit:base', [
     671        grunt.registerTask( 'precommit:image', [
    672672                'imagemin:core'
    673673        ] );
    674674
     
    714714
    715715                function run( type ) {
    716716                        var command = map[ type ].split( ' ' );
    717                         var taskList = [ 'precommit:base' ];
    718717
    719718                        grunt.util.spawn( {
    720719                                cmd: command.shift(),
    721720                                args: command
    722721                        }, function( error, result, code ) {
     722                                var taskList = [];
     723
    723724                                if ( code !== 0 ) {
    724725                                        grunt.fatal( 'The `' +  map[ type ] + '` command returned a non-zero exit code.', code );
    725726                                }
    726727
     728                                [ 'png', 'jpg', 'gif', 'jpeg' ].forEach( function( extension ) {
     729                                        if ( ( result.stdout + '\n' ).indexOf( '.' + extension + '\n' ) !== -1 ) {
     730                                                grunt.log.writeln( 'Image files modified. Minifying.');
     731                                                taskList.push( 'precommit:image' );
     732                                        }
     733                                } );
     734
    727735                                [ 'js', 'css', 'php' ].forEach( function( extension ) {
    728736                                        if ( ( result.stdout + '\n' ).indexOf( '.' + extension + '\n' ) !== -1 ) {
    729737                                                grunt.log.writeln( extension.toUpperCase() + ' files modified. ' + extension.toUpperCase() + ' tests will be run.');
     
    769777                'precommit:php',
    770778                'precommit:js',
    771779                'precommit:css',
    772                 'precommit:base'
     780                'precommit:image'
    773781        ] );
    774782
    775783        // Testing tasks.