2 /* eslint no-console:"off" */
7 gulp
= require( "gulp" );
9 console
.error("You are missing required Node modules; run `npm install`.");
13 const gutil
= require( "gulp-util" );
14 const sass
= require("gulp-sass");
15 const cssnano
= require("gulp-cssnano");
16 const sourcemaps
= require('gulp-sourcemaps');
17 const autoprefixer
= require('gulp-autoprefixer');
19 const STAFF_JS_BASE
= "koha-tmpl/intranet-tmpl/prog/js";
20 const STAFF_CSS_BASE
= "koha-tmpl/intranet-tmpl/prog/css";
21 const OPAC_JS_BASE
= "koha-tmpl/opac-tmpl/bootstrap/js";
22 const OPAC_CSS_BASE
= "koha-tmpl/opac-tmpl/bootstrap/css";
25 errLogToConsole
: true,
29 if( gutil
.env
.view
== "opac" ){
30 var css_base
= OPAC_CSS_BASE
;
31 var js_base
= OPAC_JS_BASE
;
33 var css_base
= STAFF_CSS_BASE
;
34 var js_base
= STAFF_JS_BASE
;
37 gulp
.task( "default", ['watch'] );
39 // CSS processing for development
40 gulp
.task('css', function() {
41 return gulp
.src( css_base
+ "/src/**/*.scss" )
42 .pipe(sourcemaps
.init())
43 .pipe(sass( sassOptions
).on('error', sass
.logError
))
45 .pipe(sourcemaps
.write('./maps'))
46 .pipe(gulp
.dest( css_base
));
49 // CSS processing for production
51 gulp
.task('build', function() {
52 return gulp
.src( css_base
+ "/src/**/*.scss" )
53 .pipe(sass( sassOptions
).on('error', sass
.logError
))
55 .pipe(cssnano({ zindex
: false }))
56 .pipe(gulp
.dest( css_base
));
59 gulp
.task('watch', function(){
60 gulp
.watch( css_base
+ "/src/**/*.scss", ['css'] );