-
Notifications
You must be signed in to change notification settings - Fork 13
/
gulpfile.js
56 lines (51 loc) · 1.68 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const gulp = require('gulp');
const less = require('gulp-less');
const cleanCSS = require('gulp-clean-css');
const autoprefixer = require('gulp-autoprefixer');
// const sourcemaps = require('gulp-sourcemaps'); // Uncomment when developing
// Rebuild CSS from LESS in the main directory
function compileLessMain() {
return gulp.src('ckanext/querytool/assets/less/*.less')
// .pipe(sourcemaps.init()) // Uncomment when developing
.pipe(less())
.pipe(cleanCSS({
compatibility: 'ie8'
}))
.pipe(autoprefixer({
overrideBrowserslist: [
"last 5 versions",
"ie >= 11"
]
}))
// .pipe(sourcemaps.write()) // Uncomment when developing
.pipe(gulp.dest('ckanext/querytool/assets/css'));
}
// Rebuild CSS from LESS in the inc directory
function compileLessInc() {
return gulp.src('ckanext/querytool/assets/less/inc/*.less')
// .pipe(sourcemaps.init()) // Uncomment when developing
.pipe(less())
.pipe(cleanCSS({
compatibility: 'ie8'
}))
.pipe(autoprefixer({
overrideBrowserslist: [
"last 5 versions",
"ie >= 11"
]
}))
// .pipe(sourcemaps.write()) // Uncomment when developing
.pipe(gulp.dest('ckanext/querytool/assets/css/inc'));
}
// Watch for LESS file changes
function watchFiles() {
gulp.watch('ckanext/querytool/assets/less/*.less', compileLessMain);
gulp.watch('ckanext/querytool/assets/less/inc/*.less', compileLessInc);
}
// Define complex tasks
const build = gulp.series(gulp.parallel(compileLessMain, compileLessInc), watchFiles);
// Export tasks
exports.compileLessMain = compileLessMain;
exports.compileLessInc = compileLessInc;
exports.watch = watchFiles;
exports.default = build;