我在Jekyll网站上使用grunt responsive-images。
GitHub上的相关issue现已关闭,但我仍然收到此错误。 src
和cwd
都指向单个test.jpg
图片。
当我运行grunt responsive_images:posts
时,我得到无法编译;找不到有效的源文件。
gruntfile示例:
...
responsive_images: {
posts: {
options: {
engine: 'im',
sizes: [
{ name: 'small', width: 320, quality: 80 }
]
},
files: [
{
expand: true,
src: [ '_assets/posts/**{.jpg}' ],
cwd: '_assets/posts/',
dest: 'img/'
}
]
}
},
...
Grunt依赖项:
{
"name": "corporate-programmer",
"version": "1.0.0",
"devDependencies": {
"bootstrap-sass": "^3.3.6",
"grunt": "^1.0.1",
"grunt-concurrent": "^2.3.0",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-sass": "^1.0.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-responsive-images": "^0.1.7",
"grunt-shell": "^1.3.0",
"load-grunt-tasks": "^3.5.0"
}
}
文件结构示例:
详细输出:
> npm -v
> 2.7.4
> npm list imagemagick -g
> └── imagemagick@0.1.3
答案 0 :(得分:1)
src
通常相对于cwd
中定义的路径,将您的src
值更新为**/*.js
responsive_images: {
posts: {
options: {
engine: 'im',
sizes: [
{ name: 'small', width: 320, quality: 80 }
]
},
files: [
{
expand: true,
src: [ '**/*.jpg' ],
cwd: '_assets/posts/',
dest: 'img/'
}
]
}
},