mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-24 19:59:36 +00:00
Add compilation step
This commit is contained in:
27
build.js
Normal file
27
build.js
Normal file
@@ -0,0 +1,27 @@
|
||||
// @ts-check
|
||||
|
||||
import { readFileSync, writeFileSync } from 'fs';
|
||||
|
||||
const spriteSheets = [
|
||||
{
|
||||
key: "__SPRITE_SHEET__",
|
||||
path: "./sprites/birb.png"
|
||||
},
|
||||
{
|
||||
key: "__FEATHER_SPRITE_SHEET__",
|
||||
path: "./sprites/feather.png"
|
||||
},
|
||||
{
|
||||
key: "__DECORATIONS_SPRITE_SHEET__",
|
||||
path: "./sprites/decorations.png"
|
||||
}
|
||||
];
|
||||
|
||||
let birbJs = readFileSync('birb.js', 'utf8');
|
||||
|
||||
for (const spriteSheet of spriteSheets) {
|
||||
const dataUri = readFileSync(spriteSheet.path, 'base64');
|
||||
birbJs = birbJs.replaceAll(spriteSheet.key, `data:image/png;base64,${dataUri}`);
|
||||
}
|
||||
|
||||
writeFileSync('./dist/birb.js', birbJs);
|
||||
Reference in New Issue
Block a user