我有一个带有前缀图像的文件夹,我想根据其类型(标题,预览,文章)调整大小。最初,所有图像的大小均相同。
images/
header_a.jpg
header_b.jpg
preview_a.jpg
preview_b.jpg
article_a.jpg
article_b.jpg
现在,我想调整图像的大小:
现在,我正在使用grunt-response-images调整图像的大小,但这只会将所有图像调整为相同的格式。
我能做什么?这就是我的Gruntfile现在的样子:
grunt.initConfig({
responsive_images: {
resize: {
options: {
sizes: [{
width: 640,
}]
},
files: [{
expand: true,
src: ['**.{jpg,gif,png}'],
cwd: 'app/in/',
custom_dest: 'app/out/'
}]
}
}
});
responsive_images: {
resize_header: {
options: {
sizes: [{ width: 1280 }]
},
files: [{
expand: true,
src: ['**/header*.{jpg,gif,png}'],
cwd: 'app/in/',
custom_dest: 'app/out/'
}]
},
resize_article: {
options: {
sizes: [{ width: 640 }]
},
files: [{
expand: true,
src: ['**/article*.{jpg,gif,png}'],
cwd: 'app/in/',
custom_dest: 'app/out/'
}]
},
resize_preview: {
options: {
sizes: [{ width: 200 }]
},
files: [{
expand: true,
src: ['**/preview*.{jpg,gif,png}'],
cwd: 'app/in/',
custom_dest: 'app/out/'
}]
},
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句