mirror of
https://github.com/Mibew/simple-icons.git
synced 2025-04-07 13:20:16 +03:00
Update index.js to use proper title->filename conversion
This commit is contained in:
parent
a9c4cf202f
commit
3a753611ce
12
index.js
12
index.js
@ -2,12 +2,14 @@ const dataFile = './_data/simple-icons.json';
|
|||||||
const data = require(dataFile);
|
const data = require(dataFile);
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
let Icons = {};
|
const icons = {};
|
||||||
|
|
||||||
data.icons.forEach(i => {
|
data.icons.forEach(i => {
|
||||||
i.name = i.title.toLowerCase().replace(/[^a-z0-9]/gim, '');
|
const filename = i.title.toLowerCase()
|
||||||
i.svg = fs.readFileSync(`./icons/${i.name}.svg`, 'utf8');
|
.replace(/\+/g, "plus")
|
||||||
Icons[i.name] = i
|
.replace(/[ .\-!’]/g, '');
|
||||||
|
i.svg = fs.readFileSync(`./icons/${filename}.svg`, 'utf8');
|
||||||
|
icons[i.title] = i
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = Icons;
|
module.exports = icons;
|
||||||
|
Loading…
Reference in New Issue
Block a user