mirror of
https://github.com/simple-icons/simple-icons.git
synced 2024-11-16 00:59:07 +02: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 fs = require('fs');
|
||||
|
||||
let Icons = {};
|
||||
const icons = {};
|
||||
|
||||
data.icons.forEach(i => {
|
||||
i.name = i.title.toLowerCase().replace(/[^a-z0-9]/gim, '');
|
||||
i.svg = fs.readFileSync(`./icons/${i.name}.svg`, 'utf8');
|
||||
Icons[i.name] = i
|
||||
const filename = i.title.toLowerCase()
|
||||
.replace(/\+/g, "plus")
|
||||
.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