Make WordPress Core

Ticket #29546: 29546v4.diff

File 29546v4.diff, 1.9 KB (added by MattyRob, 12 years ago)
  • Gruntfile.js

     
    22module.exports = function(grunt) {
    33        var path = require('path'),
    44                SOURCE_DIR = 'src/',
    5                 BUILD_DIR = 'build/';
     5                BUILD_DIR = 'build/',
     6                dir_path = function( dirpath ) {
     7                        // filter to requite a directory path for plugin tasks
     8                        var index, dir = grunt.option( 'dir' );
    69
     10                        // Don't filter when no target folder is specified
     11                        if ( ! dir ) {
     12                                grunt.fail.fatal('No plugin directory specified, use --dir=foldername');
     13                        }
     14
     15                        dirpath = dirpath.replace( /\\/g, '/' );
     16                        index = dirpath.lastIndexOf( '/' + dir );
     17
     18                        // Match only the folder name passed from cli
     19                        if ( -1 !== index ) {
     20                                return true;
     21                        }
     22
     23                        return false;
     24                };
     25
    726        // Load tasks.
    827        require('matchdep').filterDev(['grunt-*', '!grunt-legacy-util']).forEach( grunt.loadNpmTasks );
    928        // Load legacy utils
    … …  
    288307                                //
    289308                                //    grunt jshint:plugins --dir=foldername
    290309                                //
    291                                 filter: function( dirpath ) {
    292                                         var index, dir = grunt.option( 'dir' );
    293 
    294                                         // Don't filter when no target folder is specified
    295                                         if ( ! dir ) {
    296                                                 return true;
    297                                         }
    298 
    299                                         dirpath = dirpath.replace( /\\/g, '/' );
    300                                         index = dirpath.lastIndexOf( '/' + dir );
    301 
    302                                         // Match only the folder name passed from cli
    303                                         if ( -1 !== index ) {
    304                                                 return true;
    305                                         }
    306 
    307                                         return false;
    308                                 }
     310                                filter: dir_path
    309311                        }
    310312                },
    311313                qunit: {
    … …  
    351353                                        '!wp-includes/js/underscore.min.js',
    352354                                        '!wp-includes/js/zxcvbn.min.js'
    353355                                ]
     356                        },
     357                        plugins: {
     358                                expand: true,
     359                                cwd: SOURCE_DIR + 'wp-content/plugins',
     360                                ext: '.min.js',
     361                                src: [
     362                                        '**/*.js',
     363                                        '!**/*.min.js'
     364                                ],
     365                                // Limit Uglify's run to a single specified plugin directory:
     366                                //
     367                                //    grunt uglify:plugins --dir=foldername
     368                                //
     369                                filter: dir_path
    354370                        }
    355371                },
    356372                concat: {