-
Notifications
You must be signed in to change notification settings - Fork 9
/
gulpfile.js
31 lines (28 loc) · 1001 Bytes
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var fs = require('fs');
var gulp = require('gulp');
var handlebars = require('gulp-compile-handlebars');
var rename = require('gulp-rename');
// create a handlebars helper to look up
// fingerprinted asset by non-fingerprinted name
var handlebarOpts = {
helpers: {
assetPath: function (path, context) {
return ['/assets', context.data.root[path]].join('/');
}
}
};
gulp.task('default', function () {
// read in our manifest file
var manifest = JSON.parse(fs.readFileSync('./build/asset-manifest.json', 'utf8'));
console.log(manifest);
// read in our handlebars template, compile it using
// our manifest, and output it to index.html
gulp.src('public/userView.hbs')
.pipe(handlebars(manifest, handlebarOpts))
.pipe(rename('userView.template.html'))
.pipe(gulp.dest('functions/'));
return gulp.src('public/detailView.hbs')
.pipe(handlebars(manifest, handlebarOpts))
.pipe(rename('detailView.template.html'))
.pipe(gulp.dest('functions/'));
});