Each time I run "grunt", my JS and CSS files is uglified and linted. How to not run uglify and jshint in the beginning of the watch run and only run these tasks on save?
watch: {
// Samples.js
samplesJS: {
files: ['**/*.js'],
tasks: ['jshint:samplesJshint', 'uglify:samplesUglify'],
},
// Samples-style.css
samplesCSS: {
files: ['**/*.css'],
tasks: ['cssmin:samplesCSSMin'],
},
// Blogs.js
blogsJS: {
files: ['**/*.js'],
tasks: ['jshint:blogsJshint', 'uglify:blogsUglify'],
}
}
grunt.registerTask('default', ['jshint', 'uglify', 'cssmin', 'watch']);
Remove them from the default task:
grunt.registerTask('default', ['watch']);
Or just run grunt watch
and it'll run the watch task without triggering the other tasks.