In the process of trying to update the following I have broken it. I changed require
to import
but it is obvious that I need to do more – can anyone help? It currently reports
TypeError: template.precompile is not a function
import gulp from 'gulp';
import insert from 'gulp-insert';
import rename from 'gulp-rename';
import template from 'gulp-template';
// Compile all *.ejs files to pre-compiled templates and append *.js to the filename.
gulp.task('templates', () =>
gulp.src('./src/**/*.ejs')
.pipe(template.precompile({
evaluate: /{%([sS]+?)%}/g,
interpolate: /{{([sS]+?)}}/g,
escape: /{{{([sS]+?)}}}/g,
variable: 'ctx'
}))
.pipe(insert.prepend('Object.defineProperty(exports, "__esModule", {n' +
' value: truen' +
'});n' +
'exports.default='))
.pipe(rename({
extname: '.ejs.js'
}))
.pipe(gulp.dest('lib'))
);