【发布时间】:2017-04-22 04:24:41
【问题描述】:
我正在使用 gulp 使用 gulp-haml-coffee 渲染haml
我想做这样的事情:
header.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Website Title</title>
<link rel="stylesheet" href="style.css?v=1.0">
</head>
home.haml
INCLUDE header.html
.content
Regular Haml Content
INCLUDE footer.html
footer.html
</body>
</html>
对我来说棘手的部分是它是 HTML 和 Haml 的混合体,我希望使用 Gulp 将它们自动组合到一个文件中。
这是当前的 Gulp 任务:
// HAML
gulp.task('haml', function() {
return gulp.src('app/source/**/*.haml')
.pipe(customPlumber('HAML Error'))
.pipe(sourcemaps.init())
.pipe(haml({trace:true}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./app/compiled'))
.pipe(browserSync.reload({
stream: true
}))
});
haml 转换正在工作,但我不知道如何在转换中包含纯 HTML 文件。
我将创建几个其他 haml 文件(关于、联系人等)
这就是我希望呈现的 HTML 的样子:
home.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Website Title</title>
<link rel="stylesheet" href="style.css?v=1.0">
</head>
<div class="content">
Regular Haml Content
</div>
</body>
</html>
【问题讨论】: