-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
92 lines (80 loc) · 1.93 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
var gulp = require('gulp'),
del = require("del"),
pump = require('pump'),
htmlmin = require('gulp-htmlmin'),
sass = require('gulp-sass'),
uglify = require('gulp-uglify'),
cssnano = require('gulp-cssnano'),
imagemin = require('gulp-imagemin'),
concat = require('gulp-concat'),
nunjucksRender = require('gulp-nunjucks-render');
var paths = {
html: "src/pages/*.html",
sass: "src/static/sass/*.scss",
js: "src/static/js/*.js",
img: "src/static/img/*",
pdf: "src/static/pdf/*",
dist: "build/"
};
var names = {
js: "out.js",
css: "out.css"
};
gulp.task("html", function (cb) {
pump([
gulp.src(paths.html),
nunjucksRender({path: ['src/templates/']}),
htmlmin({collapseWhitespace: true}),
gulp.dest(paths.dist)
], cb);
});
gulp.task("sass", function (cb) {
var config = {
includePaths: ['./bower_components/bulma/', './node_modules/font-awesome/scss']
};
pump([
gulp.src(paths.sass),
sass(config),
concat(names.css),
cssnano(),
gulp.dest(paths.dist)
], cb);
});
gulp.task("js", function (cb) {
pump([
gulp.src(paths.js),
uglify({compress: {unused: false}}),
concat(names.js),
gulp.dest(paths.dist)
], cb);
});
gulp.task("img", function (cb) {
pump([
gulp.src(paths.img),
imagemin(),
gulp.dest(paths.dist + "/img")
], cb);
});
gulp.task("icons", function (cb) {
pump([
gulp.src("./node_modules/font-awesome/fonts/**.*"),
gulp.dest(paths.dist + "/fonts")
], cb)
});
gulp.task("pdf", function (cb) {
pump([
gulp.src(paths.pdf),
gulp.dest(paths.dist + "/pdf")
], cb)
});
gulp.task("clean", function () {
return del([paths.dist]);
});
gulp.task("watch", function () {
gulp.watch(paths.html, ["html"]);
gulp.watch(paths.sass, ["sass"]);
gulp.watch(paths.js, ["js"]);
gulp.watch(paths.img, ["img"]);
});
gulp.task("build", ["html", "sass", "js", "img", "icons", "pdf"]);
gulp.task("default", ["clean", "build", "watch"]);