Last active
August 10, 2017 17:53
-
-
Save sergebat/ed8d447cd3ebaeedb6d2dc161c353659 to your computer and use it in GitHub Desktop.
Pack images from each subfolder into individual spritesheet with texture packer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Iterate all folders inside resources/img/source/ | |
// Pack all images inside each folder with TexturePacker | |
// Put each individual spritesheet into resources/img/output (spritesheet name = folder name) | |
// Example: | |
// Source folders: resources/img/source/level1, resources/img/source/level2, resources/img/source/level3 ==> | |
// Output: resources/img/output/level1.json + png, resources/img/output/level2.json + png, resources/img/output/level3.json + png | |
const sh = require("shelljs"); | |
sh.pushd("resources/img/source/"); | |
sh.ls("-d", "*").forEach( | |
f => sh.exec(`TexturePacker ${f} --format easeljs --data ../output/${f}.json`) | |
); | |
sh.popd(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment