-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
60 lines (54 loc) · 1.58 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
var gulp = require('gulp');
var gulpif = require('gulp-if');
var clean = require('gulp-clean');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var webserver = require('gulp-webserver');
var browserify = require('gulp-browserify');
var sourcemaps = require('gulp-sourcemaps');
var livereload = require('gulp-livereload');
var flags = require('minimist')(process.argv.slice(2));
// Gulp command line arguments
// e.g: gulp --production
// Gulp command line arguments
var production = flags.production || false;
var debug = flags.debug || !production;
var watch = flags.watch;
gulp.task('build', function() {
return gulp.src([
'lib/vendor/BinaryLoader.js',
'lib/gaia-component.js',
'src/vr-scene.js',
'src/vr-object.js',
'src/vr-camera.js',
'src/vr-model.js',
'src/vr-billboard.js',
'src/vr-terrain.js',
'src/vr-axis-gl.js',
'src/vr-axis-dom.js',
'src/vr-lambo.js'
])
.pipe(gulpif(debug, sourcemaps.init()))
.pipe(gulpif(production, uglify()))
.pipe(concat('vr-components.js'))
.pipe(gulpif(debug, sourcemaps.write()))
.pipe(gulp.dest('./build/'))
});
gulp.task('clean', function() {
return gulp.src(['./build'], {read: false})
.pipe(clean({force: true}));
});
gulp.task('watch', function() {
livereload.listen();
gulp.watch(['src/*.js', 'gulpfile.js'], ['build']);
});
gulp.task('server', function() {
gulp.src('./')
.pipe(webserver({
livereload: true,
directoryListing: true,
open: "examples/index.html",
port: 9000
}));
});
gulp.task('default', ['clean', 'build'])