Skip to content

Instantly share code, notes, and snippets.

@jonschlinkert
Created June 23, 2017 12:55
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jonschlinkert/e2d92cca03aeee33a8b7535a2afd45b1 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ title }}</title>
</head>
<body>
<div class="page-wrap" id="page-content-container">
{% body %}
</div>
</body>
</html>
text: This is text from example.yml.
var gulp = require('gulp');
var yaml = require('js-yaml');
var assemble = require('assemble');
var helpers = require('handlebars-helpers');
var app = assemble();
var pkg = require('./package');
// only register helpers once, not every time `load` is called
app.helpers(helpers());
app.dataLoader('yml', function(str) {
return yaml.safeLoad(str);
});
// Generating HTML Pages
gulp.task('load', function(cb) {
app.data(pkg);
app.data('title', pkg.name);
app.data('example.yml');
app.layouts('default.hbs');
app.pages('test.hbs');
cb();
});
gulp.task('assemble', ['load'], function() {
return app.toStream('pages')
.pipe(app.renderFile())
.pipe(app.dest('dist'));
});
gulp.task('default', ['assemble']);
{
"name": "ceecare",
"version": "1.0.0",
"main": "gulpfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Kehinde Alabi",
"license": "ISC",
"devDependencies": {
"assemble": "^0.24.3",
"gulp": "^3.9.1",
"handlebars-helpers": "^0.8.2",
"js-yaml": "^3.8.4"
}
}
---
layout: default
---
This is test.hbs.
example.yml: {{example.text}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment