Why doesn't the GruntJS watch for the css/ folder?
But it successfully watches for /js folder.
Manual start function by default or any separate function using grunt-cli command grunt
or grunt cssmin
works correctly too...
My GruntJS code is:
module.exports = function(grunt) {
// 1. Вся настройка находится здесь
var d = new Date();
var y = d.getFullYear();
var bannerText = 'Created by Andrew Dyachenko ' + y + ''
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
dist: {
options: {
banner: '/*' + bannerText + '*/\n'
},
files: {
'js/main.min.js': ['js/main.js']
}
}
},
cssmin: {
target: {
files: [{
expand: true,
cwd: 'css/',
src: ['*.css', '!*.min.css'],
dest: 'css/',
ext: '.min.css'
}]
}
},
watch: {
options: {
livereload: true
},
scripts: {
files: ['js/*.js', 'css/*.css'],
tasks: ['process']
}
}
});
// 3. Тут мы указываем Grunt, что хотим использовать этот плагин
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-newer');
// 4. Указываем, какие задачи выполняются, когда мы вводим «grunt» в терминале
grunt.registerTask('process', ['newer:uglify', 'cssmin']);
grunt.registerTask('default', ['uglify', 'cssmin', 'watch']);
};