mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 12:58:25 +01:00
Speed up browserify
builds, don't uglify
the media builds on watch
.
Props iseulde. Fixes #31911. git-svn-id: https://develop.svn.wordpress.org/trunk@33960 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
220ba402e5
commit
16312b141b
34
Gruntfile.js
34
Gruntfile.js
@ -534,6 +534,7 @@ module.exports = function(grunt) {
|
|||||||
all: {
|
all: {
|
||||||
files: [
|
files: [
|
||||||
SOURCE_DIR + '**',
|
SOURCE_DIR + '**',
|
||||||
|
'!' + SOURCE_DIR + 'wp-includes/js/media/**',
|
||||||
// Ignore version control directories.
|
// Ignore version control directories.
|
||||||
'!' + SOURCE_DIR + '**/.{svn,git}/**'
|
'!' + SOURCE_DIR + '**/.{svn,git}/**'
|
||||||
],
|
],
|
||||||
@ -549,7 +550,10 @@ module.exports = function(grunt) {
|
|||||||
SOURCE_DIR + 'wp-includes/js/media/**/*.js',
|
SOURCE_DIR + 'wp-includes/js/media/**/*.js',
|
||||||
'!' + SOURCE_DIR + 'wp-includes/js/media/*.manifest.js'
|
'!' + SOURCE_DIR + 'wp-includes/js/media/*.manifest.js'
|
||||||
],
|
],
|
||||||
tasks: ['browserify']
|
tasks: ['browserify', 'copy:dynamic'],
|
||||||
|
options: {
|
||||||
|
spawn: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
config: {
|
config: {
|
||||||
files: 'Gruntfile.js'
|
files: 'Gruntfile.js'
|
||||||
@ -670,22 +674,26 @@ module.exports = function(grunt) {
|
|||||||
// Default task.
|
// Default task.
|
||||||
grunt.registerTask('default', ['build']);
|
grunt.registerTask('default', ['build']);
|
||||||
|
|
||||||
// Add a listener to the watch task.
|
/*
|
||||||
//
|
* Automatically updates the `:dynamic` configurations
|
||||||
// On `watch:all`, automatically updates the `copy:dynamic` and `clean:dynamic`
|
* so that only the changed files are updated.
|
||||||
// configurations so that only the changed files are updated.
|
*/
|
||||||
// On `watch:rtl`, automatically updates the `rtlcss:dynamic` configuration.
|
|
||||||
grunt.event.on('watch', function( action, filepath, target ) {
|
grunt.event.on('watch', function( action, filepath, target ) {
|
||||||
if ( target !== 'all' && target !== 'rtl' ) {
|
var src;
|
||||||
|
|
||||||
|
if ( [ 'all', 'rtl', 'browserify' ].indexOf( target ) === -1 ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var relativePath = path.relative( SOURCE_DIR, filepath ),
|
src = [ path.relative( SOURCE_DIR, filepath ) ];
|
||||||
cleanSrc = ( action === 'deleted' ) ? [relativePath] : [],
|
if ( action === 'deleted' ) {
|
||||||
copySrc = ( action === 'deleted' ) ? [] : [relativePath];
|
grunt.config( [ 'clean', 'dynamic', 'src' ], src );
|
||||||
|
} else {
|
||||||
|
grunt.config( [ 'copy', 'dynamic', 'src' ], src );
|
||||||
|
|
||||||
grunt.config(['clean', 'dynamic', 'src'], cleanSrc);
|
if ( target === 'rtl' ) {
|
||||||
grunt.config(['copy', 'dynamic', 'src'], copySrc);
|
grunt.config( [ 'rtlcss', 'dynamic', 'src' ], src );
|
||||||
grunt.config(['rtlcss', 'dynamic', 'src'], copySrc);
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user