From 582352e7b641c7745d65594b861f410819675854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Z=C3=BCger?= Date: Wed, 24 Dec 2025 23:33:29 +0100 Subject: [PATCH] Fix copying favicons build task if the directory doesn't exist --- gulpfile.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index e48cb9e..7081a94 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,3 +1,5 @@ +const fs = require('fs'); +const path = require('path'); const gulp = require('gulp'); const webpackStream = require('webpack-stream'); const webpackCore = require('webpack'); @@ -53,13 +55,22 @@ function copyResetCss() { .pipe(gulp.dest(config.output.path)); } -function copyFavicons() { +function copyFavicons(done) { const config = require('./webpack.config.js'); const projectName = process.env.npm_config_project || 'lszt'; const projectConf = projects.load(projectName); - const faviconPath = `./theme/${projectConf.theme}/favicons/*`; - return gulp.src(faviconPath, { base: `./theme/${projectConf.theme}`, allowEmpty: true }) + const faviconDir = path.join(__dirname, 'theme', projectConf.theme, 'favicons'); + + if (!fs.existsSync(faviconDir)) { + console.log(`⚠️ Skipping favicons: Directory not found at ${faviconDir}`); + return done(); + } + + return gulp.src(path.join(faviconDir, '*'), { + base: path.join(__dirname, 'theme', projectConf.theme), + allowEmpty: true + }) .pipe(gulp.dest(config.output.path)); }