1
0
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:
birjolaxew 2017-09-17 03:48:02 +02:00
parent a9c4cf202f
commit 3a753611ce
No known key found for this signature in database
GPG Key ID: 548A6D4C439CC3DD

View File

@ -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;