【发布时间】:2013-07-21 19:47:14
【问题描述】:
我正在尝试配置我的 Gruntfile 以将我的所有 Jade 文件编译为单独的 HTML 文件。例如,如果我有以下源文件夹:
source
└── templates
├── first.jade
├── second.jade
└── third.jade
然后我希望grunt jade 输出:
build
└── templates
├── first.html
├── second.html
└── third.html
这是我使用 grunt-contrib-jade 的 Gruntfile:
module.exports = function(grunt) {
grunt.initConfig({
jade: {
compile: {
options: {
client: false,
pretty: true
},
files: [ {
src: "*.jade",
dest: "build/templates/",
ext: "html",
cwd: "source/templates/"
} ]
}
},
});
grunt.loadNpmTasks("grunt-contrib-jade");
};
但是,当我运行翡翠命令时,我收到以下错误:
Running "jade:compile" (jade) task
>> Source file "first.jade" not found.
>> Source file "second.jade" not found.
>> Source file "third.jade" not found.
我做错了什么?
【问题讨论】:
-
试试
files: {"source/templates/out.html: ['source/templates/*.jade']} -
我想将它们编译成多个文件,而不是单个文件。
-
哦,我明白了...通过查看文档,扩展名似乎是这样添加的
ext: '.html',带有点。看不出问题出在哪里...您是否尝试过不使用cwd只是为了使用完整路径进行测试? -
好的,我认为这有帮助。现在我收到错误消息:
Warning: Unable to write "build/templates/" file (Error code: EISDIR). Use --force to continue. -
我看起来像是将 dest 视为一个文件。
标签: javascript node.js gruntjs