I have set up the grunt-contrib-watch task to copy a list of files to a "dist" directory every time I save one of the files of the "src" directory. Unfortunately it takes 7 to 9 seconds to accomplish this task.
I have heard about the "spawn" option for grunt-contrib-watch. Using load-grunt-tasks to load the config of each task from a separate JSON file, I changed my watch.json so that it looks like this :
{
"service": {
"files": [
"src/*.php"
],
"tasks": [
"copy:service"
],
"options": {
"spawn": "false",
"livereload": "true"
}
}
}
...but setting it to false doesn't seems to change anything : it still takes 7 to 9 seconds to run. I installed time-grunt to monitor the task timing, here is what I got when saving a file :
When saving a file, I got the following output :
Waiting...
>> File "src\myfile.php" changed.
Running "copy:service" (copy) task
Created 7 directories, copied 120 files
Done, without errors.
Execution Time (2015-06-04 11:38:23 UTC)
loading tasks 333ms ██████████████████ 40%
copy:service 490ms ██████████████████████████ 60%
Total 823ms
Completed in 7.105s at Thu Jun 04 2015 13:38:24 GMT+0200 (W. Europe Daylight Time)
So it looks like the task in itself took less than a second, meaning that Grunt itself would take 6 seconds to load ? That seems pretty high. I'm on Windows 7, I've heard that on Windows there could be some performance issues.