My website utilizes LESS files and my gulpfile.js
is structured as follows:
var gulp = require("gulp");
var fs = require("fs");
var less = require("gulp-less");
var watchLess = require('gulp-watch-less2');
var embedTemplates = require('gulp-angular-embed-templates');
var concat = require('gulp-concat');
var rename = require("gulp-rename");
var csso = require('gulp-csso');
var gutil = require('gulp-util');
var terser = require('gulp-terser');
var filesExist = require('files-exist');
function buildLess(arr, outputDir, outputName) {
return gulp.src(filesExist(arr))
.pipe(less().on('error', gutil.log))
.pipe(rename(outputName + '.css'))
.pipe(gulp.dest(outputDir))
.on('error', gutil.log);
}
gulp.task('homepage', [], function () {
return buildLess([
"./css/homepage/reset.less",
"./node_modules/components-font-awesome/css/font-awesome.min.css",
"./node_modules/bootstrap/dist/css/bootstrap.css",
"./css/bootstrap-callouts.less",
"./css/homepage/global.less",
"./css/fullpage-footer.less",
"./node_modules/fullpage.js/dist/jquery.fullpage.min.css",
"./css/Header.less",
"./node_modules/angular-material/angular-material.css", // Only this exists on output file.
], './wwwroot/css/', 'homepage');
});
gulp.task('default', [
'homepage'
], function () { });
The objective is to merge all these css\less files into a single CSS file located at wwwroot/css/homepage.css
. However, upon inspection, it appears that only the last file in the list actually gets included in the output.
Noteworthy observations:
- Changing the last file in the list results in a corresponding change in the output file.
- All listed files do exist (confirmed using
filesExist(lst)
). - No error messages are displayed on screen.
Versions of npm packages I'm using:
"devDependencies": {
"gulp": "3.9.1",
"gulp-less": "3.5.0",
"gulp-watch-less": "^1.0.1",
"gulp-watch-less2": "^2.0.4",
"gulp-angular-embed-templates": "^2.3.0",
"gulp-concat": "2.6.1",
"gulp-rename": "1.4.0",
"gulp-csso": "3.0.1",
"gulp-terser": "1.1.7",
"files-exist": "1.1.0"
}
What could be causing this issue?