webfont 8.1.3 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +144 -125
- package/LICENSE +1 -1
- package/README.md +64 -159
- package/dist/cli.js +44 -39
- package/dist/index.js +4 -4
- package/dist/standalone.js +183 -231
- package/package.json +82 -61
- package/templates/template.css.njk +112 -54
- package/templates/template.html.njk +132 -64
- package/templates/template.scss.njk +115 -56
package/dist/cli.js
CHANGED
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _path = _interopRequireDefault(require("path"));
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
7
7
|
|
|
8
|
-
var _meow = require("meow");
|
|
8
|
+
var _meow = _interopRequireDefault(require("meow"));
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _resolveFrom = _interopRequireDefault(require("resolve-from"));
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _path2 = _interopRequireDefault(_path);
|
|
15
|
-
|
|
16
|
-
var _resolveFrom = require("resolve-from");
|
|
17
|
-
|
|
18
|
-
var _resolveFrom2 = _interopRequireDefault(_resolveFrom);
|
|
19
|
-
|
|
20
|
-
var _standalone = require("./standalone");
|
|
21
|
-
|
|
22
|
-
var _standalone2 = _interopRequireDefault(_standalone);
|
|
12
|
+
var _standalone = _interopRequireDefault(require("./standalone"));
|
|
23
13
|
|
|
24
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
15
|
|
|
26
|
-
const cli = (0,
|
|
16
|
+
const cli = (0, _meow.default)(`
|
|
27
17
|
Usage: webfont [input] [options]
|
|
28
18
|
|
|
29
19
|
Input: File(s) or glob(s).
|
|
@@ -62,7 +52,7 @@ const cli = (0, _meow2.default)(`
|
|
|
62
52
|
|
|
63
53
|
Only this formats generate.
|
|
64
54
|
|
|
65
|
-
-d, --dest
|
|
55
|
+
-d, --dest
|
|
66
56
|
|
|
67
57
|
Destination for generated fonts.
|
|
68
58
|
|
|
@@ -74,7 +64,7 @@ const cli = (0, _meow2.default)(`
|
|
|
74
64
|
|
|
75
65
|
Destination for generated template. If not passed used \`dest\` argument value.
|
|
76
66
|
|
|
77
|
-
-c, --template-class-name
|
|
67
|
+
-c, --template-class-name
|
|
78
68
|
|
|
79
69
|
Class name in css template.
|
|
80
70
|
|
|
@@ -86,8 +76,12 @@ const cli = (0, _meow2.default)(`
|
|
|
86
76
|
|
|
87
77
|
Font name in css template.
|
|
88
78
|
|
|
89
|
-
--
|
|
90
|
-
|
|
79
|
+
--no-sort
|
|
80
|
+
|
|
81
|
+
Keeps the files in the same order of entry
|
|
82
|
+
|
|
83
|
+
--verbose
|
|
84
|
+
|
|
91
85
|
Tell me everything!.
|
|
92
86
|
|
|
93
87
|
For "svgicons2svgfont":
|
|
@@ -203,6 +197,10 @@ const cli = (0, _meow2.default)(`
|
|
|
203
197
|
round: {
|
|
204
198
|
type: "string"
|
|
205
199
|
},
|
|
200
|
+
sort: {
|
|
201
|
+
default: true,
|
|
202
|
+
type: "boolean"
|
|
203
|
+
},
|
|
206
204
|
"start-unicode": {
|
|
207
205
|
type: "string"
|
|
208
206
|
},
|
|
@@ -232,7 +230,6 @@ const cli = (0, _meow2.default)(`
|
|
|
232
230
|
}
|
|
233
231
|
}
|
|
234
232
|
});
|
|
235
|
-
|
|
236
233
|
const optionsBase = {};
|
|
237
234
|
|
|
238
235
|
if (cli.flags.config) {
|
|
@@ -242,7 +239,7 @@ if (cli.flags.config) {
|
|
|
242
239
|
// c. relative path relative to `process.cwd()`.
|
|
243
240
|
// If none of the above work, we'll try a relative path starting
|
|
244
241
|
// in `process.cwd()`.
|
|
245
|
-
optionsBase.configFile = (0,
|
|
242
|
+
optionsBase.configFile = (0, _resolveFrom.default)(process.cwd(), cli.flags.config) || _path.default.join(process.cwd(), cli.flags.config);
|
|
246
243
|
}
|
|
247
244
|
|
|
248
245
|
if (cli.flags.fontName) {
|
|
@@ -333,6 +330,10 @@ if (cli.flags.metadata) {
|
|
|
333
330
|
optionsBase.metadata = cli.flags.metadata;
|
|
334
331
|
}
|
|
335
332
|
|
|
333
|
+
if (cli.flags.sort === false) {
|
|
334
|
+
optionsBase.sort = cli.flags.sort;
|
|
335
|
+
}
|
|
336
|
+
|
|
336
337
|
if (cli.flags.help || cli.flags.h) {
|
|
337
338
|
cli.showHelp();
|
|
338
339
|
}
|
|
@@ -341,37 +342,42 @@ if (cli.flags.version || cli.flags.v) {
|
|
|
341
342
|
cli.showVersion();
|
|
342
343
|
}
|
|
343
344
|
|
|
344
|
-
Promise.resolve().then(() =>
|
|
345
|
-
|
|
346
|
-
|
|
345
|
+
Promise.resolve().then(() => {
|
|
346
|
+
const options = Object.assign({}, optionsBase, {
|
|
347
|
+
files: cli.input
|
|
348
|
+
});
|
|
349
|
+
|
|
347
350
|
if (options.files.length === 0) {
|
|
348
351
|
cli.showHelp();
|
|
349
352
|
}
|
|
350
353
|
|
|
351
|
-
return (0,
|
|
354
|
+
return (0, _standalone.default)(options).then(result => {
|
|
352
355
|
result.config = Object.assign({}, {
|
|
353
356
|
dest: options.dest,
|
|
354
357
|
destTemplate: options.destTemplate
|
|
355
358
|
}, result.config);
|
|
356
|
-
|
|
357
359
|
return result;
|
|
358
360
|
});
|
|
359
361
|
}).then(result => {
|
|
360
|
-
const {
|
|
361
|
-
|
|
362
|
+
const {
|
|
363
|
+
fontName,
|
|
364
|
+
dest
|
|
365
|
+
} = result.config;
|
|
362
366
|
let destTemplate = null;
|
|
363
367
|
|
|
364
368
|
if (result.template) {
|
|
365
|
-
({
|
|
369
|
+
({
|
|
370
|
+
destTemplate
|
|
371
|
+
} = result.config);
|
|
366
372
|
|
|
367
373
|
if (!destTemplate) {
|
|
368
374
|
destTemplate = dest;
|
|
369
375
|
}
|
|
370
376
|
|
|
371
377
|
if (result.usedBuildInTemplate) {
|
|
372
|
-
destTemplate =
|
|
378
|
+
destTemplate = _path.default.join(destTemplate, `${result.config.fontName}.${result.config.template}`);
|
|
373
379
|
} else {
|
|
374
|
-
destTemplate =
|
|
380
|
+
destTemplate = _path.default.join(destTemplate, _path.default.basename(result.config.template).replace(".njk", ""));
|
|
375
381
|
}
|
|
376
382
|
}
|
|
377
383
|
|
|
@@ -384,17 +390,16 @@ Promise.resolve().then(() => Object.assign({}, optionsBase, {
|
|
|
384
390
|
let file = null;
|
|
385
391
|
|
|
386
392
|
if (type !== "template") {
|
|
387
|
-
file =
|
|
393
|
+
file = _path.default.resolve(_path.default.join(dest, `${fontName}.${type}`));
|
|
388
394
|
} else {
|
|
389
|
-
file =
|
|
395
|
+
file = _path.default.resolve(destTemplate);
|
|
390
396
|
}
|
|
391
397
|
|
|
392
|
-
return
|
|
398
|
+
return _fsExtra.default.writeFile(file, content);
|
|
393
399
|
}))).then(() => Promise.resolve(result));
|
|
394
400
|
}).catch(error => {
|
|
395
|
-
|
|
396
|
-
|
|
401
|
+
// eslint-disable-next-line no-console
|
|
402
|
+
console.log(error.stack);
|
|
397
403
|
const exitCode = typeof error.code === "number" ? error.code : 1;
|
|
398
|
-
|
|
399
|
-
process.exit(exitCode); // eslint-disable-line no-process-exit
|
|
404
|
+
process.exit(exitCode);
|
|
400
405
|
});
|
package/dist/index.js
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.default = void 0;
|
|
6
7
|
|
|
7
|
-
var _standalone = require("./standalone");
|
|
8
|
-
|
|
9
|
-
var _standalone2 = _interopRequireDefault(_standalone);
|
|
8
|
+
var _standalone = _interopRequireDefault(require("./standalone"));
|
|
10
9
|
|
|
11
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
var _default = _standalone.default;
|
|
13
|
+
exports.default = _default;
|