-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
123 lines (108 loc) · 5.12 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
111
112
113
114
115
116
117
118
119
120
121
122
123
'use strict';
var fs = require( 'fs' );
var gulp = require( 'gulp' );
var del = require( 'del' );
var DIR = {
WWOBJLOADER_EXAMPLES: 'wwobjloader2/',
SITE: 'build/'
};
gulp.task( 'bundle-wwobjloader2', function () {
del.sync( DIR.WWOBJLOADER_EXAMPLES );
gulp.src( [ 'node_modules/wwobjloader2/test/**/*' ] )
.pipe( gulp.dest( DIR.WWOBJLOADER_EXAMPLES ) )
.on( 'end', function() {
del.sync( DIR.WWOBJLOADER_EXAMPLES + 'objloader2/main.html' );
del.sync( DIR.WWOBJLOADER_EXAMPLES + 'objloader2/main.src.html' );
del.sync( DIR.WWOBJLOADER_EXAMPLES + 'wwobjloader2/main.html' );
del.sync( DIR.WWOBJLOADER_EXAMPLES + 'wwobjloader2/main.src.html' );
del.sync( DIR.WWOBJLOADER_EXAMPLES + 'wwobjloader2stage/main.html' );
del.sync( DIR.WWOBJLOADER_EXAMPLES + 'wwobjloader2stage/main.src.html' );
del.sync( DIR.WWOBJLOADER_EXAMPLES + 'wwparallels/main.html' );
del.sync( DIR.WWOBJLOADER_EXAMPLES + 'wwparallels/main.src.html' );
del.sync( DIR.WWOBJLOADER_EXAMPLES + 'meshspray/main.html' );
del.sync( DIR.WWOBJLOADER_EXAMPLES + 'meshspray/main.src.html' );
del.sync( DIR.WWOBJLOADER_EXAMPLES + 'objverify/*' );
} );
} );
gulp.task( 'bundle-site', function () {
del.sync( DIR.SITE );
// three and helpers
gulp.src( [ 'node_modules/three/build/three.min.js' ] )
.pipe( gulp.dest( DIR.SITE + 'node_modules/three/build/' ) );
gulp.src( [ 'node_modules/three/examples/js/loaders/MTLLoader.js' ] )
.pipe( gulp.dest( DIR.SITE + 'node_modules/three/examples/js/loaders/' ) );
gulp.src( [ 'node_modules/three/examples/js/controls/TrackballControls.js' ] )
.pipe( gulp.dest( DIR.SITE + 'node_modules/three/examples/js/controls/' ) );
gulp.src( [ 'node_modules/three/examples/js/Detector.js' ] )
.pipe( gulp.dest( DIR.SITE + 'node_modules/three/examples/js' ) );
gulp.src( [
'node_modules/three/examples/js/libs/stats.min.js',
'node_modules/three/examples/js/libs/dat.gui.min.js'
] )
.pipe( gulp.dest( DIR.SITE + 'node_modules/three/examples/js/libs' ) );
// uil, bowser, jszip and file-saver
gulp.src( [ 'node_modules/uil/build/uil.min.js' ] )
.pipe( gulp.dest( DIR.SITE + 'node_modules/uil/build/' ) );
gulp.src( [ 'node_modules/bowser/bowser.min.js' ] )
.pipe( gulp.dest( DIR.SITE + 'node_modules/bowser' ) );
gulp.src( [ 'node_modules/jszip/dist/jszip.min.js' ] )
.pipe( gulp.dest( DIR.SITE + 'node_modules/jszip/dist' ) );
gulp.src( [ 'node_modules/file-saver/FileSaver.min.js' ] )
.pipe( gulp.dest( DIR.SITE + 'node_modules/file-saver' ) );
// polyfills
gulp.src( [ 'node_modules/webcomponents.js/webcomponents-lite.min.js' ] )
.pipe( gulp.dest( DIR.SITE + 'node_modules/webcomponents.js' ) );
gulp.src( [ 'node_modules/es6-promise/dist/es6-promise.auto.min.js' ] )
.pipe( gulp.dest( DIR.SITE + 'node_modules/es6-promise/dist' ) );
// wwobjloader2
gulp.src( [ 'node_modules/wwobjloader2/build/OBJLoader2.min.js' ] )
.pipe( gulp.dest( DIR.SITE + 'node_modules/wwobjloader2/build' ) );
gulp.src( [ 'node_modules/wwobjloader2/build/LoaderSupport.min.js' ] )
.pipe( gulp.dest( DIR.SITE + 'node_modules/wwobjloader2/build' ) );
gulp.src( [ 'demos/**/*' ] )
.pipe( gulp.dest( DIR.SITE + 'demos/') );
gulp.src( [ 'src/**/*' ] )
.pipe( gulp.dest( DIR.SITE + 'src/' ) );
gulp.src( [ 'wwobjloader2/**/*' ] )
.pipe( gulp.dest( DIR.SITE + 'wwobjloader2/' ) );
// resources
gulp.src( [ 'resource/obj/cerberus/*.obj' ] )
.pipe( gulp.dest( DIR.SITE + 'resource/obj/cerberus' ) );
gulp.src( [ 'resource/obj/female02/*' ] )
.pipe( gulp.dest( DIR.SITE + 'resource/obj/female02' ) );
gulp.src( [ 'resource/obj/male02/*' ] )
.pipe( gulp.dest( DIR.SITE + 'resource/obj/male02' ) );
gulp.src( [ 'resource/obj/PTV1/*.zip' ] )
.pipe( gulp.dest( DIR.SITE + 'resource/obj/PTV1' ) );
gulp.src( [ 'resource/obj/vive-controller/*.obj' ] )
.pipe( gulp.dest( DIR.SITE + 'resource/obj/vive-controller' ) );
gulp.src( [ 'resource/obj/walt/*' ] )
.pipe( gulp.dest( DIR.SITE + 'resource/obj/walt' ) );
gulp.src( [ 'resource/obj/zomax/*.zip' ] )
.pipe( gulp.dest( DIR.SITE + 'resource/obj/zomax' ) );
gulp.src( [ 'resource/fonts/*.json' ] )
.pipe( gulp.dest( DIR.SITE + 'resource/fonts/' ) );
gulp.src( [ 'resource/video/**/*' ] )
.pipe( gulp.dest( DIR.SITE + 'resource/video' ) );
gulp.src( [ 'resource/textures/meadow/**/*' ] )
.pipe( gulp.dest( DIR.SITE + 'resource/textures/meadow' ) );
gulp.src( [ 'resource/textures/skybox/**/*' ] )
.pipe( gulp.dest( DIR.SITE + 'resource/textures/skybox' ) );
gulp.src( [
'resource/textures/PixelProtestLink.png',
'resource/textures/PixelProtest.png',
'resource/textures/ProjectionSpace.jpg',
'resource/textures/PTV1Link.jpg',
'resource/textures/teaserLink.jpg',
'resource/textures/ZeroSouthLogo.png'
] )
.pipe( gulp.dest( DIR.SITE + 'resource/textures' ) );
gulp.src( [ 'index.html' ] )
.pipe( gulp.dest( DIR.SITE ) );
} );
gulp.task(
'default', function () {
console.log( 'Use "bundle-wwobjloader2" to bundle the examples from wwobjloader2.' );
console.log( 'Use "bundle-site" to bundle the complete site to the configured directory.' );
}
);