-
Notifications
You must be signed in to change notification settings - Fork 210
Expand file tree
/
Copy path.fantasticonrc.js
More file actions
47 lines (43 loc) · 1.44 KB
/
.fantasticonrc.js
File metadata and controls
47 lines (43 loc) · 1.44 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* eslint-disable */
var pkg = require('./package.json');
var path = require('path');
var mapping = require('./src/template/mapping.json');
function normalizePath(filePath) {
return filePath.replace(/\\/g, '/');
}
// Fantasticon 4.x uses glob patterns internally, which require forward slashes.
var inputDir = normalizePath(path.resolve(__dirname, 'src', 'icons'));
var outputDir = normalizePath(path.resolve(__dirname, 'dist'));
var templateHtml = normalizePath(path.resolve(__dirname, 'src', 'template', 'preview.hbs'));
var templateCss = normalizePath(path.resolve(__dirname, 'src', 'template', 'styles.hbs'));
// Convert new mapping format back to alias -> code format for fantasticon
// New format: { "code": ["alias1", "alias2", ...] }
// Fantasticon expects: { "alias1": code, "alias2": code, ... }
var codepoints = {};
Object.entries(mapping).forEach(function([code, aliases]) {
var codeNum = parseInt(code);
aliases.forEach(function(alias) {
codepoints[alias] = codeNum;
});
});
module.exports = {
name: 'codicon',
prefix: 'codicon',
codepoints: codepoints,
inputDir: inputDir,
outputDir: outputDir,
fontTypes: ['ttf'],
normalize: true,
assetTypes: ['css', 'html'],
templates: {
html: templateHtml,
css: templateCss
},
formatOptions: {
ttf: {
url: pkg.url,
description: pkg.description,
version: pkg.fontVersion
}
}
};