【发布时间】:2015-12-24 22:22:55
【问题描述】:
我正在努力为我的 Gulp 流程添加一些简单的 Markdown 处理,但我不能完全让这些部分一起工作。我似乎错过了获取前端内容和确定应用哪个 Nunjuck 模板之间的步骤。
这是我的 Gulp 文件中的部分:
gulp.task('pages:md', function() {
gulp.src('./content/**/*.md')
.pipe(frontMatter({ // optional configuration
property: 'frontMatter', // property added to file object
remove: true // should we remove front-matter header?
}))
.pipe(marked({
// optional : marked options
}))
.pipe(nunjucks({
// ?? Feels like I need to specify which template applies based on the front matter "layout" property?
}))
.pipe(gulp.dest('build/'))
});
markdown 文件如下所示:
---
title: Title
layout: layout.html
nav_active: home
---
...markdown content...
我觉得它正朝着正确的方向发展,但能否可视化前沿数据的去向,以及如何将其暴露给 Nunjucks 渲染,尚不清楚。有什么帮助吗?
【问题讨论】:
-
你过得怎么样@don-h。你的管子工作了吗?
-
嘿@rickysullivan 最后我对这个过程感到沮丧,并选择了 Metalsmith。能很好地满足我的需要。
标签: gulp markdown nunjucks yaml-front-matter