1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2024-11-26 01:00:27 +02:00
simple-icons/index.js
Jenil Gogari ca0e2ac72e add index.js file for npm
make is possible to import all icons with the SVG content, see example.js for usage
Discussion at https://github.com/simple-icons/simple-icons/pull/446
2017-09-16 16:49:58 -04:00

14 lines
319 B
JavaScript

const dataFile = './_data/simple-icons.json';
const data = require(dataFile);
const fs = require('fs');
let 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
});
module.exports = Icons;