mirror of
https://github.com/Mibew/simple-icons.git
synced 2024-11-16 10:24:12 +03:00
6e60021f55
Updates index.js filename mapping to match the Jekyll implementation. This was missed in #888 (we should implement tests to avoid this in the future). The JS implementation is a direct translation of the Jekyll one. Closes #904
19 lines
457 B
JavaScript
19 lines
457 B
JavaScript
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, '');
|
||
i.svg = fs.readFileSync(`${__dirname}/icons/${filename}.svg`, 'utf8');
|
||
icons[i.title] = i
|
||
});
|
||
|
||
module.exports = icons;
|