-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
77 lines (68 loc) · 1.89 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
const gulp = require("gulp"),
stylus = require("gulp-stylus"),
pug = require("gulp-pug"),
browserSync = require("browser-sync").create(),
webpack = require("webpack"),
gulpWebpack = require("webpack-stream");
gulp.task("gulp-webpack", function() {
return gulp
.src(["app/js/main.js"])
.pipe(
gulpWebpack(
{
entry: {
app: "./app/scripts/main.js"
},
output: {
filename: "main.bundle.js"
},
mode: "production"
},
webpack
)
)
.pipe(gulp.dest("public/js"));
});
gulp.task("stylus", function() {
return gulp
.src(["./app/styl/*.styl", "./app/styl/themes/themes.styl"])
.pipe(stylus())
.pipe(gulp.dest("./public/css/"));
});
gulp.task("pug", function buildHTML() {
return gulp
.src("app/*.pug")
.pipe(
pug({
pretty: true,
comments: true
})
)
.pipe(gulp.dest("public"));
});
gulp.task("serve", ["stylus"], function() {
browserSync.init({
open: false,
server: "./public"
});
gulp.watch(
[
"./app/styl/*.styl",
"./app/styl/helpers/*.styl",
"./app/styl/components/*.styl",
"./app/styl/themes/*.styl"
],
["stylus"]
).on("change", browserSync.reload);
gulp.watch(
[
"app/scripts/*.js",
"app/scripts/utils/*.js",
"app/scripts/parser-utils/*.js"
],
["gulp-webpack"]
).on("change", browserSync.reload);
gulp.watch("app/*.pug", ["pug"]).on("change", browserSync.reload);
gulp.watch("public/*.md").on("change", browserSync.reload);
});
gulp.task("default", ["serve"]);