-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
87 lines (75 loc) · 2.43 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
const path = require("path");
const { src, watch, dest, parallel } = require("gulp");
const less = require("gulp-less");
const if_ = require("gulp-if");
const sourcemaps = require("gulp-sourcemaps");
const rename = require("gulp-rename");
const with_sourcemaps = () => !!process.env.DEBUG;
const renamer = (path) => {
const variant = process.argv[3];
if (variant) {
// convert main/main-rtl into green/green-rtl
path.basename = path.basename.replace("main", variant.slice(2));
}
return path;
};
const build = () =>
src([
__dirname + "/ckan/public/base/less/main.less",
__dirname + "/ckan/public/base/less/main-rtl.less",
])
.pipe(if_(with_sourcemaps(), sourcemaps.init()))
.pipe(less())
.pipe(if_(with_sourcemaps(), sourcemaps.write()))
.pipe(rename(renamer))
.pipe(dest(__dirname + "/ckan/public/base/css/"));
const watchSource = () =>
watch(
__dirname + "/ckan/public/base/less/**/*.less",
{ ignoreInitial: false },
build
);
const jquery = () =>
src(__dirname + "/node_modules/jquery/dist/jquery.js").pipe(
dest(__dirname + "/ckan/public/base/vendor")
);
const bootstrap = () =>
src(__dirname + "/node_modules/bootstrap/dist/**/*").pipe(
dest(__dirname + "/ckan/public/base/vendor/bootstrap")
);
const bootstrapLess = () =>
src(__dirname + "/node_modules/bootstrap/less/**/*").pipe(
dest(__dirname + "/ckan/public/base/vendor/bootstrap/less")
);
const moment = () =>
src(__dirname + "/node_modules/moment/min/moment-with-locales.js").pipe(
dest(__dirname + "/ckan/public/base/vendor")
);
const fontAwesomeCss = () =>
src(__dirname + "/node_modules/font-awesome/css/font-awesome.css").pipe(
dest(__dirname + "/ckan/public/base/vendor/font-awesome/css")
);
const fontAwesomeFonts = () =>
src(__dirname + "/node_modules/font-awesome/fonts/*").pipe(
dest(__dirname + "/ckan/public/base/vendor/font-awesome/fonts")
);
const fontAwesomeLess = () =>
src(__dirname + "/node_modules/font-awesome/less/*").pipe(
dest(__dirname + "/ckan/public/base/vendor/font-awesome/less")
);
const jQueryFileUpload = () =>
src(__dirname + "/node_modules/blueimp-file-upload/js/*.js").pipe(
dest(__dirname + "/ckan/public/base/vendor/jquery-fileupload/")
);
exports.build = build;
exports.watch = watchSource;
exports.updateVendorLibs = parallel(
jquery,
bootstrap,
bootstrapLess,
moment,
fontAwesomeCss,
fontAwesomeFonts,
fontAwesomeLess,
jQueryFileUpload
);