-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
48 lines (43 loc) · 1.26 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
var postcss = require('gulp-postcss');
var gulp = require('gulp');
var babel = require('gulp-babel');
var minify = require('gulp-minify');
var watch = require('gulp-watch');
gulp.task('css', function () {
return gulp.src('./src/*.css')
.pipe(postcss())
.pipe(gulp.dest('./dist'));
});
gulp.task('babel1',function () {
gulp.src('src/index.js')
.pipe(babel({
presets: ['env']
}))
.pipe(minify({
noSource:true,
ext:{min:'.js'}
}))
.pipe(gulp.dest('dist'))
});
gulp.task('babel2',function () {
gulp.src('src/play.js')
.pipe(babel({
presets: ['env']
}))
.pipe(minify({
noSource:true,
ext:{min:'.js'}
}))
.pipe(gulp.dest('dist'))
});
gulp.task('watch',function () {
var watcher1 = gulp.watch('src/**/*.js', ['babel1']);
watcher1.on('change', function(event) {
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
});
var watcher2 = gulp.watch('src/**/*.css', ['css']);
watcher2.on('change', function(event) {
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
});
});
gulp.task('default',['css','babel1','babel2']);