-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
72 lines (63 loc) · 1.68 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
var gulp = require('gulp');
var watch = require('gulp-watch');
var del = require('del');
var browserSync = require('browser-sync').create();
var umd = require('gulp-umd');
var babel = require('gulp-babel');
var deleteLines = require('gulp-delete-lines');
var concat = require('gulp-concat');
var files = [
'./js/src/utils.js',
'./js/src/elm.js',
'./js/src/modal.js',
'./js/src/alert.js',
'./js/src/formgenerator.js',
'./js/src/emitter.js',
'./js/src/droppad.js',
'./js/src/loader.js',
'./js/src/backdrop.js',
'./js/src/imagepreloader.js',
'./js/src/timeline.js',
];
gulp.task('default', ['build', 'watch']);
gulp.task('build', ['transpile', 'concat', 'umd']);
gulp.task('transpile', function () {
return gulp.src(files)
.pipe(deleteLines({
'filters': [/^(export|import).*/gm]
}))
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('./js/dist/'));
});
gulp.task('umd', function () {
return gulp.src('./js/dist/*.js')
.pipe(umd())
.pipe(gulp.dest('./dist/umd/'));
});
gulp.task('concat', function () {
return gulp.src(files)
.pipe(deleteLines({
'filters': [/^(export|import).*/gm]
}))
.pipe(babel({
presets: ['es2015']
}))
.pipe(concat('ghostTools.js'))
.pipe(gulp.dest('./dist/'))
});
gulp.task('clean', function () {
del('./js/dist/**/*');
del('/dist/umd/**/*')
});
gulp.task('watch', ['browser-sync'], function () {
gulp.watch('js/src/*.js', ['build']);
});
gulp.task('browser-sync', function () {
browserSync.init({
server: {
baseDir: "./"
}
});
});