-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.babel.js
More file actions
82 lines (71 loc) · 2.46 KB
/
gulpfile.babel.js
File metadata and controls
82 lines (71 loc) · 2.46 KB
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
73
74
75
76
77
78
79
80
81
82
import gulp from 'gulp';
import del from 'del';
import gulpLoadPlugins from 'gulp-load-plugins';
import webpack from 'webpack-stream';
import runSequence from 'run-sequence';
let plugins = gulpLoadPlugins();
gulp.task('build', cb => runSequence('clean',['build:babel', 'build:css'], 'build:webpack', 'clean:tmp', cb));
gulp.task('build:webpack', () => gulp.src('.tmp/*.js')
.pipe(plugins.plumber())
.pipe(webpack({
output: {
filename: 'datetime-range.min.js',
libraryTarget: 'umd'
},
externals: {
"angular": "angular",
"moment": "moment",
"moment-range": "moment-range",
"moment-timezone": "moment-timezone"
}
}))
.pipe(plugins.uglify())
.pipe(gulp.dest('dist'))
.on('error', function (err) { console.error(err); }));
gulp.task('build:webpack:dev', () => gulp.src('.tmp/*.js')
.pipe(plugins.plumber())
.pipe(webpack({
output: {
filename: 'datetime-range.js',
libraryTarget: 'umd'
},
externals: {
"angular": "angular",
"moment": "moment",
"moment-range": "moment-range",
"moment-timezone": "moment-timezone"
}
}))
.pipe(gulp.dest('dist'))
.on('error', function (err) { console.error(err); }));
gulp.task('build:babel', () => gulp.src('src/*.js')
.pipe(plugins.plumber())
.pipe(plugins.babel())
.pipe(plugins.angularEmbedTemplates({logger:console.log, debug:true}))
.pipe(plugins.uglify())
.pipe(gulp.dest('.tmp'))
.on('error', function (err) { console.error(err); }));
gulp.task('build:css', () => gulp.src('src/*.css')
.pipe(plugins.plumber())
.pipe(plugins.cssnano())
.pipe(plugins.concat('datetime-range.min.css'))
.pipe(gulp.dest('dist')))
.on('error', function (err) { console.error(err); });
gulp.task('build:dev', () => {
gulp.src('src/*.css')
.pipe(plugins.plumber())
.pipe(gulp.dest('dist'));
return gulp.src('src/*.js')
.pipe(plugins.plumber())
.pipe(plugins.babel())
.pipe(plugins.angularEmbedTemplates({logger:console.log, debug:true}))
.pipe(gulp.dest('.tmp'))
.on('error', function (err) { console.error(err); });
});
gulp.task('clean', () => del('dist'));
gulp.task('clean:tmp', () => del('.tmp'));
gulp.task('dev:build', cb => runSequence('clean','build:dev', 'build:webpack:dev', 'clean:tmp', cb));
gulp.task('dev', cb => runSequence('dev:build', 'watch', cb));
gulp.task('watch', function() {
gulp.watch(['src/**/*.+(js|html|css)', 'index.*'], ['dev:build']);
});