Skip to content

Commit

Permalink
multipage filter
Browse files Browse the repository at this point in the history
  • Loading branch information
cpietsch committed Jan 14, 2022
1 parent c25087d commit a62eb9c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/textures.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ exports.run = async function textures(inputPath, options) {
const skipExisting = options.skip || false;
const spriteFormat = options.spriteFormat || "jpg";
const spriteQuality = options.spriteQuality || 70;

const multipe = options.multipe || false;

const workPath = createPath(path.resolve(outputPath));
const spritesPath = createPath(workPath + "/sprites");
Expand Down Expand Up @@ -52,13 +52,18 @@ exports.run = async function textures(inputPath, options) {

const resizer = cascade.run(inputPath, resizeSteps, { skipExisting });

const spritesheetFiles = []
let spritesheetFiles = []
for await (const operation of resizer) {
console.log(operation.progress, operation.file);
if (operation.log[2]) spritesheetFiles.push(operation.log[2])
else console.error("Error with file", operation.file);
}

if(multipe){
// this only works if the _ is only used fpr multipage files
spritesheetFiles = spritesheetFiles.filter(file => file.indexOf("_") == -1)
}

const spriter = await sharpsheet(spritesheetFiles, spritesPath, {
outputFormat: spriteFormat,
outputQuality: spriteQuality,
Expand Down

0 comments on commit a62eb9c

Please sign in to comment.