2017-10-12 05:39:46 +02:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
const fs = require('fs');
|
|
|
|
const webfontsGenerator = require('webfonts-generator');
|
|
|
|
|
|
|
|
fs.readdir('./static/assets/icons', function (err, files) {
|
|
|
|
if (err) {
|
|
|
|
console.error(err);
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Filter out any non-SVG files and join by absolute path
|
|
|
|
const svg = files.filter(function (file) {
|
|
|
|
return file.slice(-4) === '.svg';
|
|
|
|
}).map(function (file) {
|
|
|
|
return './static/assets/icons/' + file;
|
|
|
|
});
|
|
|
|
|
|
|
|
// Generate webfonts
|
|
|
|
const options = {
|
|
|
|
files: svg,
|
2017-11-12 10:13:09 +01:00
|
|
|
dest: './static/generated/icons/fonts',
|
2017-10-12 05:39:46 +02:00
|
|
|
fontName: 'zulip-icons',
|
2017-11-12 10:13:09 +01:00
|
|
|
cssDest: './static/generated/icons/style.css',
|
2017-10-12 05:39:46 +02:00
|
|
|
cssFontsUrl: 'fonts/',
|
|
|
|
templateOptions: {
|
|
|
|
classPrefix: '',
|
|
|
|
baseSelector: '.zulip-icon',
|
|
|
|
},
|
|
|
|
cssTemplate: './static/icons/fonts/template.hbs',
|
|
|
|
};
|
|
|
|
webfontsGenerator(options, function (err) {
|
|
|
|
if (err) {
|
|
|
|
console.error(err);
|
|
|
|
process.exit(1);
|
|
|
|
}
|
2017-11-12 10:13:09 +01:00
|
|
|
console.log('SUCCESS! Webfonts generated in ./static/generated/icons/fonts.');
|
2017-10-12 05:39:46 +02:00
|
|
|
});
|
|
|
|
});
|