-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·36 lines (29 loc) · 980 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
31
32
33
34
35
36
'use strict';
var babel = require('gulp-babel'),
gulp = require('gulp'),
gulpif = require('gulp-if'),
notify = require('gulp-notify'),
uglify = require('gulp-uglify'),
umd = require('gulp-umd'),
util = require('gulp-util');
function onError() {
notify.onError({ title: 'Compile Error', message: '<%= error.message %>' }).apply(this, arguments);
util.beep();
};
gulp.task('default', () => {
let myProduction = process.env.NODE_ENV === 'production';
let mySource = 'src/array.js',
myDestination = 'dist';
let myUmdOptions = {
templateName: 'returnExports',
exports: (file) => null,
};
let myBabelOptions = {
presets: ['es2015'],
};
return gulp.src(mySource)
.pipe(babel(myBabelOptions))
.pipe(umd(myUmdOptions)).on('error', onError.bind(this))
.pipe(gulpif(myProduction, uglify())).on('error', onError.bind(this))
.pipe(gulp.dest(myDestination));
});