-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
52 lines (43 loc) · 1.4 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
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 + "/ckanext/iaea/public/base/less/main.less",
__dirname + "/ckanext/iaea/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 + "/ckanext/iaea/fanstatic/css"));
const dataxplorerbuild = () =>
src([
__dirname + "/ckanext/iaea/public/base/less/dataexplorer.less",
])
.pipe(if_(with_sourcemaps(), sourcemaps.init()))
.pipe(less())
.pipe(if_(with_sourcemaps(), sourcemaps.write()))
.pipe(rename(renamer))
.pipe(dest(__dirname + "/ckanext/iaea/fanstatic/css/"));
const watchSource = () =>
watch(
__dirname + "/ckanext/iaea/public/base/less/**/*.less",
{ ignoreInitial: false },
build
);
exports.dataxplorer = dataxplorerbuild
exports.build = build;
exports.watch = watchSource;