forked from alexbakum/example-videojs-hls-bundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
110 lines (101 loc) · 3.73 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var gutil = require('gulp-util');
var browserSync = require('browser-sync').create();
var path = require('path');
var collapse = require('bundle-collapser/plugin');
//process.env.BROWSERIFYSHIM_DIAGNOSTICS=1;
gulp.task('js:videojs', function () {
return browserify()
.require(path.dirname(require.resolve('video.js')) + "/video.novtt.dev.js", {expose: 'video.js', fullPaths: false})
.plugin(collapse)
.bundle()
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.pipe(source('videojs.js'))
.pipe(gulp.dest('./dist/js'));
});
gulp.task('js:videojs-ads-ima-standalone', function () {
return browserify('./src/videojs.ads.ima/index.js', { fullPaths: false })
.exclude('video.js')
.plugin(collapse)
.bundle()
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.pipe(source('videojs.ads.ima.js'))
.pipe(gulp.dest('./dist/js'));
});
gulp.task('js:videojs-hls-standalone', function () {
return browserify('./src/videojs.hls/index.js', { fullPaths: false })
.exclude('video.js')
.plugin(collapse)
.bundle()
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.pipe(source('videojs.hls.js'))
.pipe(gulp.dest('./dist/js'));
});
gulp.task('js:videojs-ga-standalone', function() {
return browserify('./src/videojs.ga/index.js', { fullPaths: false })
.exclude('video.js')
.plugin(collapse)
.bundle()
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.pipe(source('videojs.ga.js'))
.pipe(gulp.dest('./dist/js'));
});
gulp.task('js:videojs-bundle', function () {
return browserify('./src/videojs.bundle/index.js', { fullPaths: false })
.plugin(collapse)
.bundle()
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.pipe(source('videojs.bundle.js'))
.pipe(gulp.dest('./dist/js'));
});
gulp.task('js:copy-videojs-vtt.js', function () {
return gulp.src(path.dirname(require.resolve('video.js')) + '/../../node_modules/vtt.js/dist/vtt.min.js')
.pipe(gulp.dest('dist/js'));
});
gulp.task('js', [
'js:videojs',
'js:videojs-ads-ima-standalone',
'js:videojs-hls-standalone',
'js:videojs-ga-standalone',
'js:videojs-bundle',
'js:copy-videojs-vtt.js'
]);
gulp.task('css:copy-videojs.min.css', function () {
gulp.src(path.dirname(require.resolve('video.js')) + '/video-js.min.css')
.pipe(gulp.dest('dist/css'));
});
gulp.task('css:copy-videojs.ads.css', function () {
gulp.src('node_modules/videojs-contrib-ads/src/videojs.ads.css')
.pipe(gulp.dest('dist/css'));
});
gulp.task('css:copy-videojs.ima.css', function () {
gulp.src('node_modules/videojs-ima/src/videojs.ima.css')
.pipe(gulp.dest('dist/css'));
});
gulp.task('css', [
'css:copy-videojs.min.css',
'css:copy-videojs.ads.css',
'css:copy-videojs.ima.css'
]);
gulp.task('fonts:copy-videojs-font', function () {
gulp.src(path.dirname(require.resolve('video.js')) + '/font/**')
.pipe(gulp.dest('dist/css/font'));
});
gulp.task('fonts', ['fonts:copy-videojs-font']);
gulp.task('swf:copy-videojs-swf', function () {
gulp.src('node_modules/videojs-swf/dist/*.swf')
.pipe(gulp.dest('dist/swf'));
});
gulp.task('swf', ['swf:copy-videojs-swf']);
gulp.task('dev:bs', ['default'], function() {
browserSync.init({
server: {baseDir: './'},
directory: true
});
gulp.watch(['src/**/*.js', 'examples/*.html'], ['dev:watch']);
});
gulp.task('dev:watch', ['default'], browserSync.reload);
gulp.task('dev', ['dev:bs']);
gulp.task('default', ['js', 'fonts', 'css', 'swf']);