From b7d026e44584899c3ed22c4868217febcca6d1dc Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Fri, 9 Dec 2022 13:07:44 +1100 Subject: [PATCH] Bundle the font For performance, offline support and privacy. Cut down the CSS file from the package so that we only need to bundle the one font file, like what Google was doing. --- assets/index.html | 4 ++-- assets/source-code-pro.css | 7 +++++++ package-lock.json | 14 ++++++++++++++ package.json | 1 + 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 assets/source-code-pro.css diff --git a/assets/index.html b/assets/index.html index 962822b2f..12b0c2b6f 100644 --- a/assets/index.html +++ b/assets/index.html @@ -6,7 +6,7 @@ speedscope - + - \ No newline at end of file + diff --git a/assets/source-code-pro.css b/assets/source-code-pro.css new file mode 100644 index 000000000..e97079e1f --- /dev/null +++ b/assets/source-code-pro.css @@ -0,0 +1,7 @@ +@font-face{ + font-family: 'Source Code Pro'; + font-weight: 400; + font-style: normal; + font-stretch: normal; + src: url('../node_modules/source-code-pro/TTF/SourceCodePro-Regular.ttf') format('truetype'); +} diff --git a/package-lock.json b/package-lock.json index e19b5d670..a6c8710c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,6 +34,7 @@ "preact": "10.4.1", "prettier": "2.0.4", "protobufjs": "6.8.8", + "source-code-pro": "2.38.0", "source-map": "0.6.1", "ts-jest": "24.3.0", "typescript": "4.2.3", @@ -4473,6 +4474,7 @@ "resolved": "https://registry.npmjs.org/deasync/-/deasync-0.1.19.tgz", "integrity": "sha512-oh3MRktfnPlLysCPpBpKZZzb4cUC/p0aA3SyRGp15lN30juJBTo/CiD0d4fR+f1kBtUQoJj1NE9RPNWQ7BQ9Mg==", "dev": true, + "hasInstallScript": true, "dependencies": { "bindings": "^1.5.0", "node-addon-api": "^1.7.1" @@ -12455,6 +12457,12 @@ "node": ">=0.10.0" } }, + "node_modules/source-code-pro": { + "version": "2.38.0", + "resolved": "https://registry.npmjs.org/source-code-pro/-/source-code-pro-2.38.0.tgz", + "integrity": "sha512-JMXu7l3XrLREG17eEwY66ANG9716WTu6OeNvZfRKQKANEvbSERDZjk5AYTHeV6owQNPQTeiiW3ri2Ou93XFGvg==", + "dev": true + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -25570,6 +25578,12 @@ "kind-of": "^3.2.0" } }, + "source-code-pro": { + "version": "2.38.0", + "resolved": "https://registry.npmjs.org/source-code-pro/-/source-code-pro-2.38.0.tgz", + "integrity": "sha512-JMXu7l3XrLREG17eEwY66ANG9716WTu6OeNvZfRKQKANEvbSERDZjk5AYTHeV6owQNPQTeiiW3ri2Ou93XFGvg==", + "dev": true + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", diff --git a/package.json b/package.json index e0056eae2..9552d1a0f 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "preact": "10.4.1", "prettier": "2.0.4", "protobufjs": "6.8.8", + "source-code-pro": "2.38.0", "source-map": "0.6.1", "ts-jest": "24.3.0", "typescript": "4.2.3",