function htmlRedirects()

in gulpfile.js [658:680]


function htmlRedirects (cb) {
  const file = fs.readFileSync('./src/config.yaml', 'utf8');
  const config = jsyaml.parse(file);
  // Exit if we have no redirects
  if (!config.redirects) {
    return cb();
  }

  // Create redirect page for each
  config.redirects.forEach((r) => {
    // HBS templating
    const templateData = {
      target: r.target
    };

    return gulp.src('./src/redirect.hbs')
      .pipe(hb({data: templateData, helpers: hbsHelpers, partials: ['./src/partials/*'], handlebars: handlebars}))
      .pipe(rename(`${r.source}`))
      .pipe(gulp.dest('./dist/'));
  });

  return cb();
};