1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-31 02:10:55 +00:00
FrankerFaceZ/bin/update_fonts.js
Tobias Speicher 61a9e80de0
Replace deprecated String.prototype.substr()
String.prototype.substr() is deprecated (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) so we replace it with slice() which works similarily but isn't deprecated.
Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
2022-03-20 01:18:55 +01:00

24 lines
648 B
JavaScript

'use strict';
const fs = require('fs');
const path = require('path');
const dir = 'styles/fontello';
for(const file of fs.readdirSync(dir)) {
if ( file.endsWith('.css') ) {
const old_path = path.join(dir, file),
new_path = `${old_path.slice(0, -4)}.scss`;
fs.renameSync(old_path, new_path);
}
}
const config = JSON.parse(fs.readFileSync('fontello.config.json', 'utf8'));
const icons = config.glyphs.map(x => x.css);
fs.writeFileSync('src/utilities/ffz-icons.js', `'use strict';
// This is a generated file. To update it, please run: npm run font:update
/* eslint quotes: 0 */
export default ${JSON.stringify(icons, null, '\t')};`);