2 /* eslint no-console:"off" */
4 const { dest, series, src, watch } = require('gulp');
6 const sass = require("gulp-sass");
7 const cssnano = require("gulp-cssnano");
8 const sourcemaps = require('gulp-sourcemaps');
9 const autoprefixer = require('gulp-autoprefixer');
10 const args = require('minimist')(process.argv.slice(2));
12 const STAFF_JS_BASE = "koha-tmpl/intranet-tmpl/prog/js";
13 const STAFF_CSS_BASE = "koha-tmpl/intranet-tmpl/prog/css";
14 const OPAC_JS_BASE = "koha-tmpl/opac-tmpl/bootstrap/js";
15 const OPAC_CSS_BASE = "koha-tmpl/opac-tmpl/bootstrap/css";
17 if (args.view == "opac") {
18 var css_base = OPAC_CSS_BASE;
19 var js_base = OPAC_JS_BASE;
21 var css_base = STAFF_CSS_BASE;
22 var js_base = STAFF_JS_BASE;
26 errLogToConsole: true,
30 // CSS processing for development
32 return src(css_base + "/src/**/*.scss")
33 .pipe(sourcemaps.init())
34 .pipe(sass(sassOptions).on('error', sass.logError))
36 .pipe(sourcemaps.write('./maps'))
37 .pipe(dest(css_base));
40 // CSS processing for production
42 return src(css_base + "/src/**/*.scss")
43 .pipe(sass(sassOptions).on('error', sass.logError))
45 .pipe(cssnano({ zindex: false }))
46 .pipe(dest(css_base));
49 exports.build = build;
51 exports.default = function () {
52 watch(css_base + "/src/**/*.scss", series('css'));