Bug 26519: Clean up OPAC buttons with incorrect classes
[koha.git] / gulpfile.js
blobd2164c9bb1dbf576c453ffefee344a369597b924
1 /* eslint-env node */
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 rtlcss = require('gulp-rtlcss');
9 const sourcemaps = require('gulp-sourcemaps');
10 const autoprefixer = require('gulp-autoprefixer');
11 const args = require('minimist')(process.argv.slice(2));
12 const rename = require('gulp-rename');
14 const STAFF_JS_BASE = "koha-tmpl/intranet-tmpl/prog/js";
15 const STAFF_CSS_BASE = "koha-tmpl/intranet-tmpl/prog/css";
16 const OPAC_JS_BASE = "koha-tmpl/opac-tmpl/bootstrap/js";
17 const OPAC_CSS_BASE = "koha-tmpl/opac-tmpl/bootstrap/css";
19 if (args.view == "opac") {
20     var css_base = OPAC_CSS_BASE;
21     var js_base = OPAC_JS_BASE;
22 } else {
23     var css_base = STAFF_CSS_BASE;
24     var js_base = STAFF_JS_BASE;
27 var sassOptions = {
28     errLogToConsole: true,
29     precision: 3
32 // CSS processing for development
33 function css() {
34     return src(css_base + "/src/**/*.scss")
35         .pipe(sourcemaps.init())
36         .pipe(sass(sassOptions).on('error', sass.logError))
37         .pipe(autoprefixer())
38         .pipe(sourcemaps.write('./maps'))
39         .pipe(dest(css_base))
41         .pipe(rtlcss())
42         .pipe(rename({
43             suffix: '-rtl'
44         })) // Append "-rtl" to the filename.
45         .pipe(dest(css_base));
48 // CSS processing for production
49 function build() {
50     return src(css_base + "/src/**/*.scss")
51         .pipe(sass(sassOptions).on('error', sass.logError))
52         .pipe(autoprefixer())
53         .pipe(cssnano({
54             zindex: false
55         }))
56         .pipe(dest(css_base))
58         .pipe(rtlcss())
59         .pipe(rename({
60             suffix: '-rtl'
61         })) // Append "-rtl" to the filename.
62         .pipe(dest(css_base));
65 exports.build = build;
66 exports.css = css;
67 exports.default = function () {
68     watch(css_base + "/src/**/*.scss", series('css'));