-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
gulpfile.js
29 lines (21 loc) · 847 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
const {dest, parallel, series, src} = require('gulp');
const del = require('del');
const rename = require('gulp-rename');
const rollup = require('gulp-better-rollup');
const uglify = require('gulp-uglify-es').default;
const BUILD_DIR = 'dist';
const cleanUp = () => del([BUILD_DIR]);
const pack = format => () => src(`lib/gettext.js`)
.pipe(rollup({format, name:'i18n', amd: {id: null}}))
.pipe(rename({suffix: `.${format}`}))
.pipe(dest(BUILD_DIR));
const minify = name => () => src(`./${BUILD_DIR}/gettext.${name}.js`)
.pipe(rename({suffix: '.min'}))
.pipe(uglify({output: { comments: 'some' }}))
.pipe(dest(BUILD_DIR));
const formats = ['amd', 'cjs', 'esm', 'iife'/*, 'system', 'umd'*/];
const build = series(
parallel(formats.map(pack)),
parallel(formats.map(minify))
);
exports.default = series(cleanUp, build);