Gruntjs grunt contrib即使在使用spawn时也会缓慢观察=false
我已经设置了grunt contrib watch任务,每次保存“src”目录中的一个文件时,都会将文件列表复制到“dist”目录。不幸的是,完成这项任务需要7到9秒 我听说了这件事。使用load grunt tasks从一个单独的JSON文件加载每个任务的配置,我更改了我的watch.JSON,使其如下所示:Gruntjs grunt contrib即使在使用spawn时也会缓慢观察=false,gruntjs,grunt-contrib-watch,Gruntjs,Grunt Contrib Watch,我已经设置了grunt contrib watch任务,每次保存“src”目录中的一个文件时,都会将文件列表复制到“dist”目录。不幸的是,完成这项任务需要7到9秒 我听说了这件事。使用load grunt tasks从一个单独的JSON文件加载每个任务的配置,我更改了我的watch.JSON,使其如下所示: { "service": { "files": [ "src/*.php" ], "tasks": [
{
"service": {
"files": [
"src/*.php"
],
"tasks": [
"copy:service"
],
"options": {
"spawn": "false",
"livereload": "true"
}
}
}
…但将其设置为false似乎不会改变任何事情:运行仍然需要7到9秒。我安装了time grunt来监视任务计时,下面是我在保存文件时得到的结果:
保存文件时,我得到以下输出:
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)
所以看起来任务本身只花了不到一秒钟的时间,这意味着Grunt本身需要6秒钟来加载?这似乎很高。我使用的是Windows 7,我听说在Windows上可能会出现一些性能问题。同样的问题,在更改并执行任务后,所有模块都会重新加载 但我在github上找到了一个非常好的解决方案 () 官方grunt contrib手表怎么了? 由于历史原因,它使用fs.fileWatch和fs.watch的组合,因此速度慢且有问题。从节点0.9.2+,fs.watch正常 怎么办?
npm install grunt-este-watch --save-dev
grunt.loadNpmTasks('grunt-contrib-watch');
观看
grunt.loadNpmTasks('grunt-este-watch');
watch: {
javascript: {
files: 'src/js/**/*',
tasks: ['uglify']
}
}
到
同样的问题,在更改并执行任务后,所有模块都被重新加载 但我在github上找到了一个非常好的解决方案 () 官方grunt contrib手表怎么了? 由于历史原因,它使用fs.fileWatch和fs.watch的组合,因此速度慢且有问题。从节点0.9.2+,fs.watch正常 怎么办?
npm install grunt-este-watch --save-dev
grunt.loadNpmTasks('grunt-contrib-watch');
观看
grunt.loadNpmTasks('grunt-este-watch');
watch: {
javascript: {
files: 'src/js/**/*',
tasks: ['uglify']
}
}
到