Owen Leonard
2df87a94f5
This patch converts the OPAC LESS files to SCSS. In the process of converting opac.less (and other .less files) to .scss, I have improved the completeness of the nesting, reordered properties, and in general done cleanup based on rules in .scss-lint.yml. All of these changes should have no impact on the style of the OPAC. This patch modifies the commands used to compile CSS so that OPAC and staff assets can be processed separately: 'yarn build' <-- Builds the staff client assets by default 'yarn build --view opac' <-- Builds OPAC assets To test, apply the patch and compile the CSS by running the command above (or apply the follow-up patch with compiled CSS). Do a thorough review of the OPAC, taking care to cover as many pages as possible and checking responsive behavior at the same time. There should be no visual differences in the OPAC before and after applying the patch. Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
61 lines
No EOL
1.6 KiB
JavaScript
61 lines
No EOL
1.6 KiB
JavaScript
/* eslint-env node */
|
|
/* eslint no-console:"off" */
|
|
|
|
let gulp;
|
|
|
|
try {
|
|
gulp = require( "gulp" );
|
|
} catch(e) {
|
|
console.error("You are missing required Node modules; run `npm install`.");
|
|
process.exit(1);
|
|
}
|
|
|
|
const gutil = require( "gulp-util" );
|
|
const sass = require("gulp-sass");
|
|
const cssnano = require("gulp-cssnano");
|
|
const sourcemaps = require('gulp-sourcemaps');
|
|
const autoprefixer = require('gulp-autoprefixer');
|
|
|
|
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";
|
|
|
|
var sassOptions = {
|
|
errLogToConsole: true,
|
|
precision: 3
|
|
}
|
|
|
|
if( gutil.env.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;
|
|
}
|
|
|
|
gulp.task( "default", ['watch'] );
|
|
|
|
// CSS processing for development
|
|
gulp.task('css', function() {
|
|
return gulp.src( css_base + "/src/**/*.scss" )
|
|
.pipe(sourcemaps.init())
|
|
.pipe(sass( sassOptions ).on('error', sass.logError))
|
|
.pipe(autoprefixer())
|
|
.pipe(sourcemaps.write('./maps'))
|
|
.pipe(gulp.dest( css_base ));
|
|
});
|
|
|
|
// CSS processing for production
|
|
|
|
gulp.task('build', function() {
|
|
return gulp.src( css_base + "/src/**/*.scss" )
|
|
.pipe(sass( sassOptions ).on('error', sass.logError))
|
|
.pipe(autoprefixer())
|
|
.pipe(cssnano())
|
|
.pipe(gulp.dest( css_base ));
|
|
});
|
|
|
|
gulp.task('watch', function(){
|
|
gulp.watch( css_base + "/src/**/*.scss", ['css'] );
|
|
}); |