-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate.font.js
More file actions
29 lines (27 loc) · 873 Bytes
/
generate.font.js
File metadata and controls
29 lines (27 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const fs = require('fs');
const webfontsGenerator = require('webfonts-generator');
fs.readdir('svg-icons', (err, items) => {
if (err) console.info('can`t read res directory');
const files = items.filter((i) => i.toLowerCase().endsWith('.svg')).map((i) => `svg-icons/${i}`);
webfontsGenerator({
fontName: 'as',
templateOptions: {
classPrefix: 'as-',
baseSelector: '.as',
},
files: files,
centerHorizontally: true,
dest: 'dest',
types: ['svg', 'eot', 'woff', 'woff2', 'ttf'],
fileName: 'app.[fontname].[hash].[ext]',
html: true,
htmlTemplate: 'custom-html.hbs',
cssTemplate: 'custom-css.hbs',
}, (error) => {
if (error) {
console.error('Fail!', error);
} else {
console.info('Done');
}
});
});