forked from bcgov/met-formio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
30 lines (29 loc) · 900 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
'use strict';
const gulp = require('gulp');
const insert = require('gulp-insert');
const rename = require('gulp-rename');
const template = require('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: /\{%([\s\S]+?)%\}/g,
interpolate: /\{\{([\s\S]+?)\}\}/g,
escape: /\{\{\{([\s\S]+?)\}\}\}/g,
variable: 'ctx',
}),
)
.pipe(
insert.prepend(
'Object.defineProperty(exports, "__esModule", {\n' + ' value: true\n' + '});\n' + 'exports.default=',
),
)
.pipe(
rename({
extname: '.ejs.js',
}),
)
.pipe(gulp.dest('lib')),
);