Make WordPress Core

Ticket #29546: 29546.diff

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

     
    293293
    294294                                        // Don't filter when no target folder is specified
    295295                                        if ( ! dir ) {
    296                                                 return true;
     296                                                grunt.fail.fatal('No plugin directory specified, use --dir=foldername');
    297297                                        }
    298298
    299299                                        dirpath = dirpath.replace( /\\/g, '/' );
    … …  
    351351                                        '!wp-includes/js/underscore.min.js',
    352352                                        '!wp-includes/js/zxcvbn.min.js'
    353353                                ]
     354                        },
     355                        plugins: {
     356                                expand: true,
     357                                cwd: SOURCE_DIR + 'wp-content/plugins',
     358                                dest: BUILD_DIR,
     359                                ext: '.min.js',
     360                                src: [
     361                                        '**/*.js',
     362                                        '!**/*.min.js'
     363                                ],
     364                                // Limit Uglify's run to a single specified plugin directory:
     365                                //
     366                                //    grunt uglify:plugins --dir=foldername
     367                                //
     368                                filter: function( dirpath ) {
     369                                        var index, dir = grunt.option( 'dir' );
     370
     371                                        // Don't filter when no target folder is specified
     372                                        if ( ! dir ) {
     373                                                grunt.fail.fatal('No plugin directory specified, use --dir=foldername');
     374                                        }
     375
     376                                        dirpath = dirpath.replace( /\\/g, '/' );
     377                                        index = dirpath.lastIndexOf( '/' + dir );
     378
     379                                        // Match only the folder name passed from cli
     380                                        if ( -1 !== index ) {
     381                                                return true;
     382                                        }
     383
     384                                        return false;
     385                                }
    354386                        }
    355387                },
    356388                concat: {