This repository was archived by the owner on Sep 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
117 lines (102 loc) · 2.76 KB
/
gulpfile.js
File metadata and controls
117 lines (102 loc) · 2.76 KB
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
"use strict";
var gulp = require("gulp");
var browserSync = require("browser-sync");
var nodemon = require("gulp-nodemon");
const imagemin = require("gulp-imagemin");
const mozjpeg = require("imagemin-mozjpeg");
const pngquant = require("imagemin-pngquant");
gulp.task("images", () =>
gulp
.src("public/images/**/*")
.pipe(
imagemin(
[
mozjpeg({
quality: "60",
quantTable: 2
}),
pngquant({
quality: "60"
})
],
{
optimizationLevel: 3,
progressive: true,
interlaced: true
}
)
)
.pipe(gulp.dest("public/images"))
);
gulp.task("fa", ["fa-css"], function() {
return gulp
.src("node_modules/font-awesome/fonts/*")
.pipe(gulp.dest("public/fonts"));
});
gulp.task("fa-css", function() {
return gulp
.src("node_modules/font-awesome/css/font-awesome.min.css")
.pipe(gulp.dest("public/stylesheets"));
});
gulp.task("bs", ["bs-css", "bs-jquery", "bs-tether", "bs-js"], function() {});
gulp.task("bs-css", function() {
return gulp
.src("node_modules/bootstrap/dist/css/bootstrap.min.css")
.pipe(gulp.dest("public/stylesheets"));
});
gulp.task("bs-jquery", function() {
return gulp
.src("node_modules/jquery-slim/dist/jquery.slim.min.js")
.pipe(gulp.dest("public/javascripts"));
});
gulp.task("bs-tether", function() {
return gulp
.src("node_modules/tether/dist/js/tether.min.js")
.pipe(gulp.dest("public/javascripts"));
});
gulp.task("bs-js", function() {
return gulp
.src("node_modules/bootstrap/dist/js/bootstrap.min.js")
.pipe(gulp.dest("public/javascripts"));
});
gulp.task("browser-sync", ["nodemon"], function() {
browserSync.init(null, {
proxy: "http://localhost:3000",
files: ["public/**/*.*"],
port: 3001
});
});
gulp.task("nodemon", function(cb) {
var started = false;
return nodemon({
exec: "node --debug",
script: "./bin/www"
})
.on("start", function() {
// to avoid nodemon being started multiple times
// thanks @matthisk
if (!started) {
cb();
started = true;
}
})
.on("restart", function onRestart() {
// reload connected browsers after a slight delay
setTimeout(function reload() {
browserSync.reload({
stream: false
});
}, 500);
});
});
gulp.task("bs-reload", function() {
browserSync.reload();
});
gulp.task("default", ["browser-sync"], function() {
gulp.watch("config/**/*.js", ["bs-reload"]);
gulp.watch("models/**/*.js", ["bs-reload"]);
gulp.watch("controllers/**/*.js", ["bs-reload"]);
gulp.watch("views/**/*.pug", ["bs-reload"]);
gulp.watch("public/**/*.js", ["bs-reload"]);
gulp.watch("public/**/*.css", ["bs-reload"]);
});