-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
75 lines (65 loc) · 2.08 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
// Add our dependencies
var gulp = require('gulp'), // Main Gulp module
concat = require('gulp-concat'), // Gulp File concatenation plugin
open = require('gulp-open'), // Gulp browser opening plugin
connect = require('gulp-connect'), // Gulp Web server runner plugin
ghPages = require('gulp-gh-pages'); // Gulp Web server runner plugin
// Configuration
var configuration = {
paths: {
src: {
html: './*.html',
js: [
"./js/*.js"
]
},
dist: './dist'
},
localServer: {
port: 8000,
host: '0.0.0.0',
url: 'http://0.0.0.0:8000/'
}
};
// Gulp task to copy HTML files to output directory
gulp.task('html', function () {
gulp.src(configuration.paths.src.html)
.pipe(gulp.dest(configuration.paths.dist))
.pipe(connect.reload());
});
gulp.task('js', function () {
gulp.src(configuration.paths.src.js)
.pipe(gulp.dest(configuration.paths.dist + '/js'))
.pipe(connect.reload());
});
// Gulp task to create a web server
gulp.task('connect', function () {
connect.server({
root: 'dist',
host: configuration.localServer.host,
port: configuration.localServer.port,
livereload: true
});
});
// Gulp task to open the default web browser
gulp.task('open', function () {
gulp.src('dist/index.html')
.pipe(open({ uri: configuration.localServer.url }));
});
// Watch the file system and reload the website automatically
gulp.task('watch', function () {
gulp.watch(configuration.paths.src.html, ['html']);
gulp.watch(configuration.paths.src.js, ['js']);
gulp.watch(configuration.paths.src.data, ['data']);
gulp.watch(configuration.paths.src.jsartoolkit5, ['artoolkit']);
gulp.watch(configuration.paths.src.threex, ['threex']);
});
gulp.task("build", ['html', 'js']);
// Gulp default task
gulp.task('default', ['html', 'js', 'connect', 'watch']);
gulp.task("deploy", ["build"], () => {
return gulp.src('dist/**/*', { dot: true })
.pipe(ghPages({
force: true
}));
});