Skip to content

Commit 4ef8507

Browse files
committed
Build/Test Tools: Optimize uglify:core and copy:files glob patterns in Grunt tasks.
The `uglify:core` and `copy:files` tasks utilized broad negative glob patterns (`!**/*.min.js` and `!**/*.map`) to exclude files from processing. The glob expansion scans the entire `src/` directory tree, including `wp-content`. For environments where `wp-content` contains deep directory structures (such as plugins with `node_modules` dependencies) this traversal becomes prohibitively slow, causing the build process to hang. This change scopes the exclusion patterns to specific directories (e.g. `wp-admin`, `wp-includes`, default themes, and Akismet), limiting the file scan to relevant core paths and preventing unnecessary recursion into `wp-content`. In one dev environment, this reduces `npm run build:dev` from 43s to 9s, and `npm run build` from 51s to 13s. Developed in WordPress#10809 Follow up to [61475]. Props westonruter, jonsurrell. See #63606. Fixes #64563. git-svn-id: https://develop.svn.wordpress.org/trunk@61545 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 97b09c8 commit 4ef8507

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Gruntfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ module.exports = function(grunt) {
286286
'!wp-includes/certificates/legacy-1024bit.pem',
287287
'!.{svn,git}', // Exclude version control folders.
288288
'!wp-includes/version.php', // Exclude version.php.
289-
'!**/*.map', // The build doesn't need .map files.
289+
'!{wp-admin,wp-includes,wp-content/themes/twenty*,wp-content/plugins/akismet}/**/*.map', // The build doesn't need .map files.
290290
'!index.php', '!wp-admin/index.php',
291291
'!_index.php', '!wp-admin/_index.php'
292292
] ),
@@ -925,7 +925,7 @@ module.exports = function(grunt) {
925925
'wp-includes/js/tinymce/plugins/wp*/plugin.js',
926926

927927
// Exceptions.
928-
'!**/*.min.js',
928+
'!{wp-admin,wp-includes}/**/*.min.js',
929929
'!wp-admin/js/custom-header.js', // Why? We should minify this.
930930
'!wp-admin/js/farbtastic.js',
931931
'!wp-includes/js/wp-emoji-loader.js', // This is a module. See the emoji-loader task below.

0 commit comments

Comments
 (0)