--- a/gulpfile.js Thu Feb 13 12:11:01 2020 +0100
+++ b/gulpfile.js Mon Jun 29 22:33:36 2020 +0200
@@ -1,53 +1,35 @@
-var gulp = require('gulp'),
- concat = require('gulp-concat');
+
+const { src, dest, task, watch, parallel } = require('gulp');
+const concat = require('gulp-concat');
+const less = require('gulp-less');
-var package = require("./package.json"),
- scripts = package.scripts;
+const
+ package = require('./package.json'),
+ paths = package.paths;
+
+
+task('css', function() {
+ return src(paths.less_main, { cwd: paths.less_base })
+ .pipe(less())
+ .pipe(dest(paths.less_target));
+});
-/** Fix pipe function */
-function fixPipe(stream) {
- var origPipe = stream.pipe;
- stream.pipe = function (dest) {
- arguments[0] = dest.on('error', function (error) {
- var nextStreams = dest._nextStreams;
- if (nextStreams) {
- nextStreams.forEach(function (nextStream) {
- nextStream.emit('error', error);
- });
- } else if (dest.listeners('error').length === 1) {
- throw error;
- }
- });
- var nextStream = fixPipe(origPipe.apply(this, arguments));
- (this._nextStreams || (this._nextStreams = [])).push(nextStream);
- return nextStream;
- };
- return stream;
-}
-
-var origSrc = gulp.src;
-
-gulp.src = function() {
- return fixPipe(origSrc.apply(this, arguments));
-};
+task('scripts', function() {
+ return src(paths.sources, { cwd: paths.base })
+ .pipe(concat(paths.target.replace(/{version}/, package.version)))
+ .pipe(dest(paths.base));
+});
-// Gulp tasks
-gulp.task('scripts', function() {
- return gulp.src(scripts.sources, {cwd: scripts.base})
- .pipe(concat(scripts.target.replace(/{version}/, package.version)))
- .pipe(gulp.dest(scripts.base));
+task('scripts_core', function() {
+ return src(paths.core_sources, { cwd: paths.base })
+ .pipe(concat(paths.core_target.replace(/{version}/, package.version)))
+ .pipe(dest(paths.base));
});
-gulp.task('scripts-core', function() {
- return gulp.src(scripts.core_sources, {cwd: scripts.base})
- .pipe(concat(scripts.core_target.replace(/{version}/, package.version)))
- .pipe(gulp.dest(scripts.base));
-});
-gulp.task('watch', function() {
- gulp.watch(scripts.sources, {cwd: scripts.base}, ['scripts', 'scripts-core']);
-});
-
-gulp.task('default', ['scripts', 'scripts-core', 'watch']);
+exports.default = function() {
+ watch(paths.sources, { cwd: paths.base }, parallel('scripts', 'scripts_core'));
+ watch(paths.less_sources, { cwd: paths.less_base}, parallel('css'));
+};