Javascript 无法编译;使用grunt响应映像未找到有效的源文件
我在一个Jekyll网站上使用 GitHub上的一个相关文件现在已关闭,但我仍然收到此错误。Javascript 无法编译;使用grunt响应映像未找到有效的源文件,javascript,node.js,gruntjs,Javascript,Node.js,Gruntjs,我在一个Jekyll网站上使用 GitHub上的一个相关文件现在已关闭,但我仍然收到此错误。src和cwd都指向一个test.jpg图像 当我运行grunt-responsive\u-images:posts时,我发现无法编译;找不到有效的源文件。 Grunfile的示例: ... responsive_images: { posts: { options: { engine: 'im', sizes: [ { na
src
和cwd
都指向一个test.jpg
图像
当我运行grunt-responsive\u-images:posts
时,我发现无法编译;找不到有效的源文件。
Grunfile的示例:
...
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/'
}
]
}
},
...
{
"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"
}
}
咕噜依赖项:
...
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/'
}
]
}
},
...
{
"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"
}
}
文件结构示例:
...
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/'
}
]
}
},
...
{
"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"
}
}
详细输出:
...
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/'
}
]
}
},
...
{
"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"
}
}
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/'
}
]
}
},
啊,谢谢!虽然这引入了一个新的错误,但我认为它解决了这个问题。如何知道ImageMagick是否正确安装<代码>>>生成标识eNONT警告:请确保已正确安装ImageMagick代码>brew安装imagemagick`或参阅以了解更多详细信息。或者,将options.engine设置为“gm”以使用GraphicsMagck。使用--force继续。默认情况下,机器上未安装Imagemagick,如果您在Mac上,则需要使用
brew安装Imagemagick
进行安装。Windows/Linux-您需要查找这些方向谢谢,我现在正在Windows上安装。会让你知道事情的进展。工作!谢谢你的帮助!