-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
42 lines (37 loc) · 1.37 KB
/
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
37
38
39
40
41
42
const gulp = require('gulp'),
clean = require('gulp-clean'),
babel = require('gulp-babel'),
sourcemaps = require('gulp-sourcemaps'),
gutil = require('gulp-util'),
concat = require('gulp-concat');
gulp.task('build', () => {
gutil.log('Build for Node ...');
gulp.src('src/**/*.js')
.pipe(babel({
presets: ['es2015-node4'],
comments: false
}).on('error', err => gutil.log('Some shit appends for node dist ... ', err.message)))
.pipe(sourcemaps.init())
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist_node'));
gutil.log('Build for browser ...');
gulp.src('src/**/*.js')
.pipe(babel({
presets: ['es2015'],
comments: false
}).on('error', err => gutil.log('Some shit appends for browser dist ...', err.message)))
.pipe(sourcemaps.init())
.pipe(concat('../bin/LazyPromise.browser.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist_browser'));
});
gulp.task('clean', () => {
gulp.src(['dist_node/**/*', 'dist_browser/**/*', 'temp'], {read: false})
.pipe(clean())
});
gulp.task('watch', ['cleanBuild'], () => {
gulp.watch(['bower.json', 'src/index.html'], ['bower']);
gulp.watch('src/**/*.js', ['build']);
});
gulp.task('default', ['watch']);
gulp.task('cleanBuild', ['clean', 'build']);