simple-icons/index.js

19 lines
457 B
JavaScript
Raw Normal View History

const dataFile = './_data/simple-icons.json';
const data = require(dataFile);
const fs = require('fs');
const icons = {};
data.icons.forEach(i => {
const filename = i.title.toLowerCase()
.replace(/\+/g, "plus")
.replace(/^\./, "dot-")
.replace(/\.$/, "-dot")
.replace(/\./g, "-dot-")
.replace(/[ !]/g, '');
2017-09-17 05:46:33 +03:00
i.svg = fs.readFileSync(`${__dirname}/icons/${filename}.svg`, 'utf8');
icons[i.title] = i
});
module.exports = icons;