क्या एकाधिक फाइल/फ़ोल्डरों को देखना संभव है लेकिन grunt-contrib-imagemine और grunt-contrib-watch का उपयोग करके केवल एक ही फ़ाइल को अनुकूलित करना संभव है?Grunt imagemin - एकाधिक फाइल/फ़ोल्डरों को एकल फ़ाइल को अनुकूलित करने के लिए देखें?
मैं इस तरह की कोशिश की: (gruntfile का हिस्सा)
imagemin: {
dist: {
cwd: 'images/modules',
files: ['images/modules/**/*.{png,jpg,gif}'],
dest: 'images/modules'
}
},
watch: {
images: {
files: ['images/modules/**/*.{png,jpg,gif}'],
tasks: ['imagemin'],
options: {
spawn: false,
}
}
}
grunt.event.on('watch', function(action, filepath, target) {
if (grunt.file.isMatch(grunt.config('watch.images.files'), filepath)) {
grunt.config('imagemin.dist.src', [filepath]);
}
});
लेकिन यह काम नहीं करता। यह लौटाता है:
Running "imagemin:dist" (imagemin) task
Verifying property imagemin.dist exists in config...OK
Files: [no src] -> images/modules
Options: optimizationLevel=7, progressive, pngquant=false
Options: optimizationLevel=7, progressive, pngquant=false
Warning: path must be a string
कोई विचार? धन्यवाद।