【发布时间】:2018-04-23 20:39:33
【问题描述】:
我的src/ 目录如下:
src/
---about/
------history.pug
------mission.pug
---contact/
------email.pug
---index.pug
我希望我的 .pug 文件以这样的方式编译,即使在 dist/ 目录中它们也能保持此目录层次结构。比如:
dist/
---about/
------history.html
------mission.html
---contact/
------email.html
---index.html
我正在使用 Gulp 来处理 pug 文件。这可以通过使用 gulp 或其他方式的一项任务来实现吗?谢谢!
处理我的 pug 文件的 Gulp 任务:
gulp.task('pug', function() {
return gulp.src('src/pug/*.pug')
.pipe(pug({
basedir: "./"
}))
.pipe(gulp.dest('dist/html'));
})
【问题讨论】:
-
是的,只需一项任务即可轻松实现。你应该展示你的代码。
-
@Mark 编辑了问题以包括我的 Gulp 任务。我怎样才能将它合并到那里?