Reputation: 105
I am trying to add Grunts imagemin plugin and it is working fine if I want to work in one directory only. However I have a multilingual site and therefore I have separate image directories for both English and French images. Is there a way to apply this plugin so it watches both directories and sends the compressed images to different destinations?
Here is what I have at the moment as the standard implementation:
imagemin: {
dymanic: {
files: [{
expand: true,
cwd: 'English/assets/img/',
src: ['**/*.{png,jpg,gif}'],
dest: 'English/assets/img/build/'
}]
}
}
What I need to do is also add a French location in the 'cwd' field and a French destination in the 'dest' field but I don't know how to add this to the existing code.
Thanks
Upvotes: 1
Views: 198
Reputation: 2119
you don't need use: dynamic {} or static {}, you can remove English and french will works perfect.
see: Grunt imagemin running but not minifying
Upvotes: 0
Reputation: 105
I found the simple answer in case anyone else is having this issue. I simply change dynamic
to a unique name and then copied the code again and gave it a new name. Example below:
imagemin: {
English: {
files: [{
expand: true,
cwd: 'English/assets/img/',
src: ['**/*.{png,jpg,gif}'],
dest: 'English/assets/img/build/'
}]
},
French: {
files: [{
expand: true,
cwd: 'French/assets/img/',
src: ['**/*.{png,jpg,gif}'],
dest: 'French/assets/img/build/'
}]
}
}
If anyone knows of a shorter way to achieve this then please let me know. Otherwise this appears to work exactly as I need it to.
Upvotes: 2