我是gulp框架的新手。我一直在研究一个小的gulp脚本,它将 Markdown 文件通过管道传输到 JSON 字符串,然后使用Jade模板呈现最终的 HTML。我gulp-wrap
用来将数据传递到我的玉模板
// md to jade blog
gulp.task('blog', () => {
gulp.src(path.join(dirs.source, dirs.blogs, entries.md))
.pipe(md(marked))
.pipe(plumber())
.pipe(wrap(function(data) {
// read correct jade template from disk
let template = path.join(dirs.source, dirs.layouts, data.contents.template)
// template location is at 'src/_layouts/base-blog.jade'
return fs.readFileSync(template).toString();
}, {
}, {
engine: 'jade'
}))
.pipe(rename({extname:'.html'}))
.pipe(gulp.dest(dest));
});
}
当我运行它时,我不断收到以下错误:
Message:
Jade:11
9| //- var pageTitle = config.pageTitle || ''
10|
> 11| include ../_modules/project-list/project-list
12| include ../_modules/about/about
13|
14| doctype html
the "filename" option is required to use "include" with "relative" paths
Details:
path: undefined
有谁知道如何解决这个问题?