Tomas Cohen Arazi
a7e3c12e61
This patch makes the gulpfile work with gulp v4 on Node v12. To test it, make sure your dev env has Node.js v12. It also replaces the use of 'gulp-util' (deprecated) by 'minimist' as recommended on their site. On both KTD and KohaDevBox edit your sources.list so the node line points to 'node_12.x' instead of 'node_8.x'. Once that's done: 1. On your clone run: $ yarn install $ npm install -E 2. Build the CSS: $ yarn build $ yarn build --view opac => SUCCESS: Things build correctly 3. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
/* eslint-env node */
|
|
/* eslint no-console:"off" */
|
|
|
|
const { dest, series, src, watch } = require('gulp');
|
|
|
|
const sass = require("gulp-sass");
|
|
const cssnano = require("gulp-cssnano");
|
|
const sourcemaps = require('gulp-sourcemaps');
|
|
const autoprefixer = require('gulp-autoprefixer');
|
|
const args = require('minimist')(process.argv.slice(2));
|
|
|
|
const STAFF_JS_BASE = "koha-tmpl/intranet-tmpl/prog/js";
|
|
const STAFF_CSS_BASE = "koha-tmpl/intranet-tmpl/prog/css";
|
|
const OPAC_JS_BASE = "koha-tmpl/opac-tmpl/bootstrap/js";
|
|
const OPAC_CSS_BASE = "koha-tmpl/opac-tmpl/bootstrap/css";
|
|
|
|
if (args.view == "opac") {
|
|
var css_base = OPAC_CSS_BASE;
|
|
var js_base = OPAC_JS_BASE;
|
|
} else {
|
|
var css_base = STAFF_CSS_BASE;
|
|
var js_base = STAFF_JS_BASE;
|
|
}
|
|
|
|
var sassOptions = {
|
|
errLogToConsole: true,
|
|
precision: 3
|
|
}
|
|
|
|
// CSS processing for development
|
|
function css() {
|
|
return src(css_base + "/src/**/*.scss")
|
|
.pipe(sourcemaps.init())
|
|
.pipe(sass(sassOptions).on('error', sass.logError))
|
|
.pipe(autoprefixer())
|
|
.pipe(sourcemaps.write('./maps'))
|
|
.pipe(dest(css_base));
|
|
}
|
|
|
|
// CSS processing for production
|
|
function build() {
|
|
return src(css_base + "/src/**/*.scss")
|
|
.pipe(sass(sassOptions).on('error', sass.logError))
|
|
.pipe(autoprefixer())
|
|
.pipe(cssnano({ zindex: false }))
|
|
.pipe(dest(css_base));
|
|
}
|
|
|
|
exports.build = build;
|
|
exports.css = css;
|
|
exports.default = function () {
|
|
watch(css_base + "/src/**/*.scss", series('css'));
|
|
}
|