-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
57 lines (49 loc) · 1.24 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
var gulp = require('gulp');
var rename = require('gulp-rename');
var browserSync = require('browser-sync').create();
var browserify = require('gulp-browserify');
var babel = require('gulp-babel');
// Static server
gulp.task('browser-sync', function() {
browserSync.init({
server: {
baseDir: 'docs'
}
});
});
gulp.task('dist', function() {
// Single entry point to browserify
gulp.src('src/webrtc.js')
.pipe(browserify({
transform: ['babelify'],
insertGlobals : true
}))
.pipe(rename('bundle.js'))
.pipe(gulp.dest('dist'))
});
gulp.task('build', function () {
gulp.src('src/*.js')
.pipe(babel())
.pipe(gulp.dest('build'))
})
gulp.task('demos', function() {
// Single entry point to browserify
gulp.src('src/webrtc.js')
.pipe(browserify({
transform: ['babelify'],
insertGlobals : true
}))
.pipe(rename('bundle.js'))
.pipe(gulp.dest('docs'))
});
gulp.task('watch-docs', function() {
gulp.watch('docs/**', function() {
browserSync.reload();
})
})
// Rerun the task when a file changes
gulp.task('watch', function() {
gulp.watch(['src/*.js'], ['demos', 'dist']);
});
gulp.task('dev', ['watch', 'browser-sync', 'watch-docs'], function() {
})