Skip to content

Commit

Permalink
feat: allow path/**/* usage for images src
Browse files Browse the repository at this point in the history
- fix manifest not found when using **/*

close Elderjs#67
  • Loading branch information
noxasch committed Jun 16, 2021
1 parent 5f5fdf2 commit 4c45b43
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/images/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, '');
Expand Down

0 comments on commit 4c45b43

Please sign in to comment.