Ticket #29546: 29546v4.diff
| File 29546v4.diff, 1.9 KB (added by , 12 years ago) |
|---|
-
Gruntfile.js
2 2 module.exports = function(grunt) { 3 3 var path = require('path'), 4 4 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' ); 6 9 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 7 26 // Load tasks. 8 27 require('matchdep').filterDev(['grunt-*', '!grunt-legacy-util']).forEach( grunt.loadNpmTasks ); 9 28 // Load legacy utils … … 288 307 // 289 308 // grunt jshint:plugins --dir=foldername 290 309 // 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 309 311 } 310 312 }, 311 313 qunit: { … … 351 353 '!wp-includes/js/underscore.min.js', 352 354 '!wp-includes/js/zxcvbn.min.js' 353 355 ] 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 354 370 } 355 371 }, 356 372 concat: {