Skip to content

Commit 6b31f30

Browse files
authored
Playground fonts (#536)
* ignore jekyll-cache * use change-case, output playgroundFonts * rebuild with renamed playgroundFonts
1 parent a4b54a3 commit 6b31f30

File tree

10 files changed

+353
-35
lines changed

10 files changed

+353
-35
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ Gemfile
1414
Gemfile.lock
1515
_site
1616
.jekyll-metadata
17+
.jekyll-cache

docs/fonts/fonts.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var fonts = {
1+
var playgroundFonts = {
22
"allertastencil-regular": {
33
"displayName": "Allerta Stencil",
44
"path": "allertastencil/AllertaStencil-Regular.ttf",

docs/playground/js/fontloader.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/playground/js/fontloader.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/playground/js/playground.js

+6-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/playground/js/playground.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/fonts/gen.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
exports.__esModule = true;
33
var fs = require("fs");
44
var path = require("path");
5+
var changeCase = require("change-case");
56
//TypeScript can't resolve import :(
67
var sortKeys = require("sort-keys");
7-
var pc = require("pretty-camel");
88
var fontRoot = "../../docs/fonts/";
99
var tags = require(fontRoot + "tags");
1010
var out = {};
@@ -18,7 +18,7 @@ dirs.forEach(function (dir) {
1818
});
1919
fonts.forEach(function (font) {
2020
var name = font.substring(0, font.length - ext.length);
21-
var display = pc(name.replace(/-regular/i, '').replace('-', ''));
21+
var display = changeCase.capitalCase(name.replace(/-regular/i, '').replace('-', ''));
2222
var key = name.toLowerCase();
2323
out[key] = { displayName: display, path: [dir, font].join('/') };
2424
});
@@ -35,4 +35,5 @@ for (var id in sorted) {
3535
sorted[id].tags = tags[id];
3636
}
3737
var json = JSON.stringify(sorted, null, ' ');
38-
write('../../docs/fonts/fonts.js', 'var fonts = ' + json + ';\n');
38+
write('../../docs/fonts/fonts.js', 'var playgroundFonts = ' + json + ';\n');
39+
console.log('playgroundFonts written successfully');

packages/fonts/gen.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as fs from "fs";
22
import * as path from "path";
3+
import * as changeCase from "change-case";
34

45
//TypeScript can't resolve import :(
56
var sortKeys = require("sort-keys");
6-
var pc = require("pretty-camel");
77
var fontRoot = "../../docs/fonts/";
88
var tags = require(fontRoot + "tags");
99

@@ -22,7 +22,7 @@ dirs.forEach(function (dir) {
2222

2323
fonts.forEach(function (font) {
2424
var name = font.substring(0, font.length - ext.length);
25-
var display = pc(name.replace(/-regular/i, '').replace('-', ''));
25+
var display = changeCase.capitalCase(name.replace(/-regular/i, '').replace('-', ''));
2626
var key = name.toLowerCase();
2727
out[key] = { displayName: display, path: [dir, font].join('/') };
2828
});
@@ -44,4 +44,6 @@ for (var id in sorted) {
4444

4545
var json = JSON.stringify(sorted, null, ' ');
4646

47-
write('../../docs/fonts/fonts.js', 'var fonts = ' + json + ';\n');
47+
write('../../docs/fonts/fonts.js', 'var playgroundFonts = ' + json + ';\n');
48+
49+
console.log('playgroundFonts written successfully')

0 commit comments

Comments
 (0)