-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
30 lines (24 loc) · 900 Bytes
/
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
const { resolve } = require("path");
const { src, watch, dest } = require("gulp");
const if_ = require("gulp-if");
const sass = require('gulp-sass')(require('sass'));
const sourcemaps = require("gulp-sourcemaps");
const with_sourcemaps = () => !!process.env.DEBUG
const themeDir = resolve("ckanext/charts/theme");
const assetsDir = resolve("ckanext/charts/assets");
const build = () => {
return src(resolve(themeDir, "charts.scss"))
.pipe(if_(with_sourcemaps(), sourcemaps.init()))
.pipe(sass({ outputStyle: !!process.env.DEBUG ? 'expanded' : 'compressed' }).on('error', sass.logError))
.pipe(if_(with_sourcemaps(), sourcemaps.write()))
.pipe(dest(resolve(assetsDir, "css")))
}
const watchSource = () => {
watch(
themeDir + "/**/*.scss",
{ ignoreInitial: false },
build
)
}
exports.build = build;
exports.watch = watchSource;