-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
41 lines (36 loc) · 1.33 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
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', ['clean'], () => {
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/EventEmitter.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', ['build'], () => {
gulp.watch(['bower.json', 'src/index.html'], ['bower']);
gulp.watch('src/**/*.js', ['build']);
});
gulp.task('default', ['watch']);