我的项目grunt文件中的观察任务似乎启动然后立即退出。
请查看附加的屏幕截图。
请找到我的Gruntfile.js代码;
module.exports = function (grunt) {
grunt.initConfig({
sass: {
options: {
cacheLocation: '.sass-cache'
},
prod: {
options: {
style: 'compressed'
},
files: [{
'assets/css/dist/main.min.css': 'assets/css/sass/main.scss'
}]
},
dev: {
options: {
style: 'nested'
},
files: [{
'assets/css/main.css': 'assets/css/sass/main.scss'
}]
}
},
imageoptim: {
files: [
'img/flat',
'img/flat/**'
],
options: {
imageAlpha: true,
jpegMini: true,
quitAfter: true
}
},
uglify: {
options: {
mangle: true,
compress: true
},
jsCompress: {
files: {
'js/dist/main.min.js': ['js/src/script1.js', 'js/src/script2.js']
}
}
},
concat: {
options: {
separator: ';',
},
dist: {
src: ['js/src/script1.js', 'js/src/script2.js'],
dest: 'js/dist/main.min.js',
}
},
watch: {
sassWatch: {
files: 'css/sass/**/*.scss',
tasks: ['sass:prod', 'sass:dev'],
},
JsWatch: {
files: ['js/modules/script1.js', 'js/modules/script2.js'],
tasks: ['uglify:jsCompress', 'concat:dist'],
}
},
notify: {
sassNotify: {
options: {
title: "Task Complete",
message: "Your Sass has been compiled and concatanatated!"
}
},
jsNotify: {
options: {
title: "Task Complete",
message: "Your JS has been minified and concatanatated!"
}
},
imageNotify: {
options: {
title: "Task Complete",
message: "All images have been compressed"
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-imageoptim');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-notify');
grunt.registerTask('sassNotify', 'watch:sassWatch');
grunt.registerTask('jsNotify', 'watch:jsWatch');
grunt.registerTask('imageNotify', 'imageoptim');
};
有人知道这个为什么会发生吗?
谢谢,
B!