Grunt - Watch Task is not working

gruntjs, javascript

Solution

My problem was that it was watching to much i had 100+ image files that it was keeping track of so i just specified what it should watch (js, html, scss, css).

Problem

It seems like my watch task in my project grunt file is starting up then quitting straight away. Please review the screenshot attached. Please find the code for my 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'); }; ``` Does anyone have an idea why this is happening? Kind Regards, B!

Original source