它可能是一块咕哝的手表,当你有很多文件时,它会挤压你的cpu。尝试禁用该功能,并检查您的cpu是否达到正常使用率(6-30%取决于您的cpu和总体使用率)。
要做到这一点,请转到
tasks/register/default.js
并删除
'watch'
从阵列中删除。
module.exports = function (grunt) {
grunt.registerTask('default', ['compileAssets', 'linkAssets', 'watch']);
};
如果您不想完全禁用咕哝观察程序,请转到
tasks/config/watch.js
并尝试排除包含大多数文件的文件夹,如果它们不在特定文件夹中,则将它们全部排除。
我将为您提供一个如何排除此任务的文件夹的示例。只需添加一个
!
在要排除的路径之前。
module.exports = function(grunt) {
grunt.config.set('watch', {
// Some config you can ignore in this case
assets: {
// Assets to watch:
files: ['assets/**/*',
'tasks/pipeline.js', '!**/node_modules/**',
'!assets/folder-to-exlude/**' // <-- HERE IS THE EXCLUDED PATH
],
// More code
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
};
我也遇到过类似的问题,这对我很有用,如果有用,请告诉我。