Bug 19893: Support for joined subfields in mappings
[koha.git] / gulpfile.js
blob1eb0d6ba316eca5bd8e0babdf27e8e9983bd6af4
1 /* eslint-env node */
2 /* eslint no-console:"off" */
4 let gulp;
6 try {
7     gulp = require( "gulp" );
8 } catch(e) {
9     console.error("You are missing required Node modules; run `npm install`.");
10     process.exit(1);
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";
24 var sassOptions = {
25     errLogToConsole: true,
26     precision: 3
29 if( gutil.env.view == "opac" ){
30     var css_base = OPAC_CSS_BASE;
31     var js_base = OPAC_JS_BASE;
32 } else {
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))
44       .pipe(autoprefixer())
45       .pipe(sourcemaps.write('./maps'))
46       .pipe(gulp.dest( css_base ));
47 });
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))
54       .pipe(autoprefixer())
55       .pipe(cssnano())
56       .pipe(gulp.dest( css_base ));
57 });
59 gulp.task('watch', function(){
60     gulp.watch( css_base + "/src/**/*.scss", ['css'] );
61 });