@ -0,0 +1 @@ |
|||
index.js |
@ -0,0 +1 @@ |
|||
build.js |
@ -0,0 +1,29 @@ |
|||
const fs = require('fs') |
|||
const { join, parse } = require('path') |
|||
|
|||
const genIcons = (iconFolder) => { |
|||
const icons = {} |
|||
|
|||
fs.readdirSync(join(__dirname, iconFolder)).forEach(filename => { |
|||
const imageType = { |
|||
'.svg': 'svg+xml', |
|||
'.png': 'png' |
|||
}[parse(filename).ext] |
|||
|
|||
if (!imageType) return |
|||
|
|||
const key = parse(filename).name |
|||
const iconFile = join(__dirname, iconFolder, filename) |
|||
const svgSource = fs.readFileSync(iconFile, 'utf8') |
|||
const b64 = Buffer.from(svgSource).toString('base64') |
|||
|
|||
icons[key] = `data:image/${imageType};base64,${b64}` |
|||
}) |
|||
|
|||
return icons |
|||
} |
|||
|
|||
const icons = genIcons('icons') |
|||
const json = JSON.stringify(icons, null, 2) |
|||
|
|||
fs.writeFileSync('index.js', `module.exports = ${json}`) |
After Width: | Height: | Size: 756 B |
After Width: | Height: | Size: 519 B |
After Width: | Height: | Size: 448 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 299 B |
After Width: | Height: | Size: 647 B |
After Width: | Height: | Size: 540 B |
After Width: | Height: | Size: 233 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 383 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 964 B |
After Width: | Height: | Size: 854 B |
After Width: | Height: | Size: 761 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 697 B |
After Width: | Height: | Size: 680 B |
After Width: | Height: | Size: 279 B |
After Width: | Height: | Size: 298 B |
After Width: | Height: | Size: 473 B |
After Width: | Height: | Size: 688 B |
After Width: | Height: | Size: 250 B |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 294 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 434 B |
After Width: | Height: | Size: 446 B |
After Width: | Height: | Size: 917 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 723 B |
After Width: | Height: | Size: 273 B |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 662 B |
After Width: | Height: | Size: 288 B |
@ -0,0 +1,12 @@ |
|||
{ |
|||
"name": "badgen-icons", |
|||
"description": "Badgen's icons", |
|||
"version": "0.1.0", |
|||
"repository": "badgen/icons", |
|||
"author": "Amio <amio.cn@gmail.com>", |
|||
"license": "ISC", |
|||
"main": "index.js", |
|||
"scripts": { |
|||
"build": "node build.js" |
|||
} |
|||
} |