Files @ c3354d6ff62a
Branch filter:

Location: CopyleftConf/copyleftconf-website/gulp/tasks/handlebars.js

Chris Lamb
Correct start of acceptance notification week date.

August 2019
Su Mo Tu We Th Fr Sa
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

re. https://twitter.com/lolamby/status/1163538533400764416
/**
 * Dependencies
 */
const fs = require('fs');
const gulp  = require('gulp');
const handlebars = require('gulp-compile-handlebars');
const path = require('path');
const rename = require('gulp-rename');

/**
 * Module body / Expose
 */
module.exports = (manifestPath, scriptSourceTemplate, staticRoot) => {
  const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
  const handlebarOpts = {
            helpers: {
                assetPath: (path, context) => {
                    return [staticRoot, context.data.root[path]].join('/');
                }
            }
        };
  const outputFile = path.basename(scriptSourceTemplate).replace('.hbs', '.html');
  return gulp.src(scriptSourceTemplate)
      .pipe(handlebars(manifest, handlebarOpts))
      .pipe(rename(outputFile));
};