gpt4 book ai didi

javascript - 无法编译;使用 grunt 响应图像找不到有效的源文件

转载 作者:太空宇宙 更新时间:2023-11-04 00:40:47 26 4
gpt4 key购买 nike

我正在使用grunt responsive-images在 Jekyll 网站上。

相关issue GitHub 上的内容现已关闭,但我仍然收到此错误。 srccwd 都指向单个 test.jpg 图像。

当我运行gruntresponsive_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"
}
}

文件结构示例:

enter image description here

详细输出:

Verbose output when running task

> npm -v
> 2.7.4

> npm list imagemagick -g
> └── imagemagick@0.1.3

最佳答案

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/'
}
]
}
},

关于javascript - 无法编译;使用 grunt 响应图像找不到有效的源文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36945133/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com