From 4c45b43dc254141ffa81fc0f980f5970a00383ec Mon Sep 17 00:00:00 2001 From: Alexander Dischberg Date: Wed, 16 Jun 2021 08:16:13 +0800 Subject: [PATCH] feat: allow path/**/* usage for images src - fix manifest not found when using **/* close #67 --- packages/images/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/images/index.js b/packages/images/index.js index 0fefcc7..c535b31 100644 --- a/packages/images/index.js +++ b/packages/images/index.js @@ -286,15 +286,16 @@ const plugin = { plugin.crossPlatformRoot = plugin.settings.rootDir.replace(/\\/gim, '/'); const imagesToProcess = folders.reduce((out, folder) => { - const relGlob = folder.src.replace('.', '').replace(/\*/g, ''); fs.ensureDirSync(path.join(plugin.settings.distDir, folder.output)); - const files = glob.sync(path.join(plugin.settings.rootDir, folder.src)); + const files = glob.sync(path.join(plugin.settings.rootDir, folder.src + `.{${imageFileTypes.join(',')}}`)); if (Array.isArray(files)) { files - .filter((file) => imageFileTypes.includes(file.split('.').pop().toLowerCase())) .filter((file) => !file.split('/').pop().includes('-ejs')) .forEach((file) => { + // fix manifest not found and wrong output folder when using **/* + const relGlob = file.replace(plugin.settings.rootDir, '').replace(file.split('/').pop(), ''); + const crossPlatformFile = file.replace(plugin.crossPlatformRoot, ''); const name = crossPlatformFile.replace(relGlob, '');