Created
June 23, 2017 12:55
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
text: This is text from example.yml. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment