-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
48 lines (41 loc) · 1.2 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 gulp = require("gulp");
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var gulpSequence = require('gulp-sequence');
var babelify = require('babelify');
var babel = require('gulp-babel');
gulp.task('bundle', function() {
return gulp.src('src/**/*.js')
.pipe(babel({
presets: ['es2015'],
plugins: ['transform-runtime']
}))
.pipe(gulp.dest("dist"));
});
gulp.task('build-demo', function() {
// b = b.transform(babelify, {presets: ['env']});
var b = browserify({
entries: './demo/index.js',
debug: false
});
return b.bundle()
.pipe(source("index.build.js"))
.pipe(buffer())
.pipe(gulp.dest("demo"));
});
gulp.task('copy-css', function() {
return gulp.src('./style.css')
.pipe(gulp.dest('./demo'));
});
gulp.task('build', gulpSequence('bundle', 'build-demo', 'copy-css'));
gulp.task('watch', function() {
return gulp.watch('**/*.js', ['build']);
});
gulp.task('default', gulpSequence('build'));
gulp.task('watch', function() {
gulp.watch('./src/*.js', function() {
gulpSequence('bundle', 'build-demo', 'copy-css')();
});
return gulp.watch('./style.css', ['copy-css']);
});