Initial commit
This commit is contained in:
7
scripts/build.js
Executable file
7
scripts/build.js
Executable file
@@ -0,0 +1,7 @@
|
||||
const files = [
|
||||
"xash.js",
|
||||
"mods.js",
|
||||
"server.js",
|
||||
"client.js",
|
||||
"menu.js"
|
||||
]
|
||||
23
scripts/processAssets.js
Normal file
23
scripts/processAssets.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const path = require('path'),
|
||||
fs = require('fs').promises,
|
||||
pixel2svg = require('pixel-art-2-svg')
|
||||
|
||||
const assetsIn = path.join(__dirname, '../assets'),
|
||||
assetsOut = path.join(__dirname, '../view/assets')
|
||||
|
||||
const write = async (location, data) => {
|
||||
const filename = path.parse(location).name + '.svg',
|
||||
writeTo = path.join(assetsOut, filename)
|
||||
|
||||
await fs.writeFile(writeTo, data, 'utf-8')
|
||||
console.log(`Converted ${filename}`)
|
||||
}
|
||||
|
||||
fs.readdir(assetsIn)
|
||||
.then(files =>
|
||||
Promise.all(files.map(at => pixel2svg(path.join(assetsIn, at) )
|
||||
.then(data => write(at, data))
|
||||
.catch(console.error)
|
||||
))
|
||||
)
|
||||
.then(files => console.log(`Processed ${files.length} file(s)!`) )
|
||||
Reference in New Issue
Block a user