Ticket #28510: 28510.3.diff
File 28510.3.diff, 4.0 KB (added by , 10 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 mediaConfig = {}, 7 mediaBuilds = ['audio-video', 'grid', 'models', 'views']; 6 8 7 9 // Load tasks. 8 10 require('matchdep').filterDev(['grunt-*', '!grunt-legacy-util']).forEach( grunt.loadNpmTasks ); … … 9 11 // Load legacy utils 10 12 grunt.util = require('grunt-legacy-util'); 11 13 14 mediaBuilds.forEach( function ( build ) { 15 var path = SOURCE_DIR + 'wp-includes/js/media/'; 16 mediaConfig[ build ] = { files : {} }; 17 mediaConfig[ build ].files[ path + build + '.js' ] = [ path + build + '.manifest.js' ]; 18 } ); 19 12 20 // Project configuration. 13 21 grunt.initConfig({ 14 22 autoprefixer: { … … 116 124 } 117 125 } 118 126 }, 119 browserify: { 120 media: { 121 files: { 122 'src/wp-includes/js/media/models.js' : [ SOURCE_DIR + 'wp-includes/js/media/models.manifest.js' ], 123 'src/wp-includes/js/media/views.js' : [ SOURCE_DIR + 'wp-includes/js/media/views.manifest.js' ], 124 'src/wp-includes/js/media/audio-video.js' : [ SOURCE_DIR + 'wp-includes/js/media/audio-video.manifest.js' ], 125 'src/wp-includes/js/media/grid.js' : [ SOURCE_DIR + 'wp-includes/js/media/grid.manifest.js' ] 126 } 127 } 128 }, 127 browserify: mediaConfig, 129 128 sass: { 130 129 colors: { 131 130 expand: true, … … 502 501 dest: SOURCE_DIR 503 502 } 504 503 }, 505 watch: {504 _watch: { 506 505 all: { 507 506 files: [ 508 507 SOURCE_DIR + '**', … … 518 517 }, 519 518 browserify: { 520 519 files: [ 521 SOURCE_DIR + 'wp-includes/js/media/**/*.js', 522 '!' + SOURCE_DIR + 'wp-includes/js/media/audio-video.js', 523 '!' + SOURCE_DIR + 'wp-includes/js/media/grid.js', 524 '!' + SOURCE_DIR + 'wp-includes/js/media/models.js', 525 '!' + SOURCE_DIR + 'wp-includes/js/media/views.js' 520 SOURCE_DIR + 'wp-includes/js/media/*.js', 521 '!' + SOURCE_DIR + 'wp-includes/js/media/*.manifest.js' 526 522 ], 527 tasks: [' browserify', 'uglify:media']523 tasks: ['uglify:media'] 528 524 }, 529 525 config: { 530 526 files: 'Gruntfile.js' … … 571 567 'jshint:media' 572 568 ] ); 573 569 574 // Pre-commit task. 575 grunt.registerTask('precommit', 'Runs front-end dev/test tasks in preparation for a commit.', 576 ['autoprefixer:core', 'imagemin:core', 'jshint:corejs', 'qunit:compiled', 'uglify:bookmarklet']); 570 grunt.renameTask( 'watch', '_watch' ); 577 571 578 // Copy task. 579 grunt.registerTask('copy:all', ['copy:files', 'copy:wp-admin-rtl', 'copy:version']); 572 grunt.registerTask( 'watch', function() { 573 if ( ! this.args.length || this.args.indexOf( 'browserify' ) > -1 ) { 574 grunt.config( 'browserify.options', { 575 browserifyOptions: { 576 debug: true 577 }, 578 watch: true 579 } ); 580 580 581 // Build task. 582 grunt.registerTask('build', ['clean:all', 'copy:all', 'cssmin:core', 'colors', 'rtl', 'cssmin:rtl', 'cssmin:colors', 583 'browserify:media', 'uglify:core', 'uglify:media', 'uglify:jqueryui', 'concat:tinymce', 'compress:tinymce', 584 'clean:tinymce', 'jsvalidate:build']); 581 grunt.task.run( 'browserify' ); 582 } 585 583 584 grunt.task.run( '_' + this.nameArgs ); 585 } ); 586 587 grunt.registerTask( 'precommit', 'Runs front-end dev/test tasks in preparation for a commit.', [ 588 'autoprefixer:core', 589 'imagemin:core', 590 'browserify', 591 'jshint:corejs', 592 'qunit:compiled', 593 'uglify:bookmarklet' 594 ] ); 595 596 grunt.registerTask( 'copy:all', [ 597 'copy:files', 598 'copy:wp-admin-rtl', 599 'copy:version' 600 ] ); 601 602 grunt.registerTask( 'build', [ 603 'clean:all', 604 'copy:all', 605 'cssmin:core', 606 'colors', 607 'rtl', 608 'cssmin:rtl', 609 'cssmin:colors', 610 'browserify', 611 'uglify:core', 612 'uglify:media', 613 'uglify:jqueryui', 614 'concat:tinymce', 615 'compress:tinymce', 616 'clean:tinymce', 617 'jsvalidate:build' 618 ] ); 619 586 620 // Testing tasks. 587 621 grunt.registerMultiTask('phpunit', 'Runs PHPUnit tests, including the ajax, external-http, and multisite tests.', function() { 588 622 grunt.util.spawn({