-
Notifications
You must be signed in to change notification settings - Fork 14
/
gulpfile.js
70 lines (63 loc) · 1.85 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
const gulp = require("gulp");
const $ = require("gulp-load-plugins")();
const path = require("path");
gulp.task("webpack", function() {
const source = "./source/javascripts/vj.js";
const config = {
watch: true,
entry: source,
output: {
filename: "[name].js"
},
module: {
loaders : [
{ test: /\.(glsl|frag|vert)$/, loader: "raw", exclude: /node_modules/ },
{
test: /\.(glsl|frag|vert)$/,
loader: "glslify",
exclude: /node_modules/
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel",
query: {
presets: ["es2015"],
compact: false
}
},
{ test:"/\.json$/", loader: "json" }
]
},
resolve : {
root : [path.join(__dirname, "bower_components")],
extensions : ["", ".js"],
alias : {
threejs : "threejs/build/three.min.js",
"dat-gui" : "dat-gui/build/dat.gui.min.js"
}
},
plugins : []
};
return gulp.src(source)
.pipe($.plumber())
.pipe($.webpack(config))
.pipe(gulp.dest("dest/javascripts"));
});
gulp.task("watch", function() {
gulp.watch("./source/sass/*.scss", ["sass"]);
});
gulp.task("sass", function() {
gulp.src("./source/sass/*.scss")
.pipe($.plumber())
.pipe($.sass())
.pipe(gulp.dest("./dest/css"));
});
gulp.task("webserver", function() {
gulp.src(".")
.pipe($.webserver({
host: "0.0.0.0",
port: "4567"
}));
});
gulp.task("default", ["webpack", "watch", "webserver"]);