-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
78 lines (71 loc) · 1.98 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
const { src, dest, pipe, series, parallel } = require("gulp");
const sass = require("gulp-sass")(require("sass"));
const postcss = require("gulp-postcss");
const autoprefixer = require("autoprefixer");
const mqpacker = require("css-mqpacker");
const concat = require("gulp-concat");
const log = require("fancy-log");
const pluginError = require("plugin-error");
const webpack = require("webpack");
const webpackConfig = require("./webpack.config");
const prettify = require("gulp-jsbeautifier");
function bootstrapCustomCss() {
var processors = [
autoprefixer,
mqpacker
];
return src("./src/scss/bootstrap-custom.scss")
.pipe(sass({
outputStyle: "expanded"
}).on("error", sass.logError))
.pipe(postcss(processors))
.pipe(dest("./assets/css/"));
}
function fokusCss(cb) {
var processors = [
autoprefixer,
mqpacker
];
return src(["./src/scss/fokus.scss", "./src/scss/fokus-print.scss"])
.pipe(sass({
outputStyle: "expanded"
}).on("error", sass.logError))
.pipe(postcss(processors))
.pipe(dest("./assets/css/"));
}
function combineCss(cb) {
var processors = [
autoprefixer,
mqpacker
];
return src(["./assets/css/bootstrap-custom.css", "./assets/css/fokus.css"])
.pipe(concat("fokus-full.css"))
.pipe(postcss(processors))
.pipe(dest("./assets/css/"));
}
// Compile Javascript
function packjs(cb) {
const myConfig = Object.assign({}, webpackConfig);
webpack(myConfig, (err, stats) => {
if (err) throw new pluginError("webpack", err);
log(`[webpack] ${stats.toString({
colors: true,
progress: true
})}`);
cb();
});
}
function prettifyjs(cb) {
src("./assets/js/fokus_template.js")
.pipe(prettify({
indent_size: 4,
js: {
indent_size: 2
}
}))
.pipe(dest("./assets/js"));
cb();
}
exports.jsbuild = series(packjs, prettifyjs);
exports.cssbuild = series(bootstrapCustomCss, fokusCss, combineCss);
exports.default = parallel(exports.cssbuild, exports.jsbuild);