From f085426605f150ca3d2aa4a370d6e70e0a7e9c0c Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Thu, 24 Aug 2023 20:40:24 +0000 Subject: [PATCH] Build Tools: Avoid doing `copy:dynamic` when running `grunt watch` when using `--dev` option. This prevents erroneously copying a file from source onto itself in source. Props westonruter, jorbin. Fixes #59196. git-svn-id: https://develop.svn.wordpress.org/trunk@56461 602fd350-edb4-49c9-b593-d223f7449a82 --- Gruntfile.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 5f0fc29d4c..22fca0ca07 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1798,8 +1798,10 @@ module.exports = function(grunt) { // Clean up only those files that were deleted. grunt.config( [ 'clean', 'dynamic', 'src' ], src ); } else { - // Otherwise copy over only the changed file. - grunt.config( [ 'copy', 'dynamic', 'src' ], src ); + if ( ! grunt.option( 'dev' ) ) { + // Otherwise copy over only the changed file. + grunt.config(['copy', 'dynamic', 'src'], src); + } // For javascript also minify and validate the changed file. if ( target === 'js-enqueues' ) {