From ee45c07314ef5aac5412621ffe59ffc144fe1afa Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sat, 8 Dec 2018 12:46:16 -0800 Subject: [PATCH] perf: build separate icons.svg file (#762) --- .gitignore | 1 + bin/build-svg.js | 8 +--- routes/_components/Avatar.html | 2 +- routes/_components/DynamicPageBanner.html | 2 +- routes/_components/ExternalLink.html | 4 +- routes/_components/IconButton.html | 4 +- routes/_components/LoadingSpinner.html | 4 +- routes/_components/NavItem.html | 4 +- routes/_components/NotLoggedInHome.html | 4 +- routes/_components/PlayVideoIcon.html | 4 +- .../_components/community/PageListItem.html | 4 +- routes/_components/compose/ComposeButton.html | 4 +- .../_components/compose/ComposeMediaItem.html | 2 +- .../dialog/components/GenericDialogList.html | 6 +-- .../dialog/components/ModalDialog.html | 4 +- routes/_components/search/Search.html | 4 +- .../settings/SettingsListItem.html | 4 +- routes/_components/status/StatusDetails.html | 6 +-- routes/_components/status/StatusHeader.html | 4 +- .../status/StatusMediaAttachments.html | 4 +- templates/2xx.html | 45 +------------------ 21 files changed, 38 insertions(+), 86 deletions(-) diff --git a/.gitignore b/.gitignore index d668b5b1..167ac045 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ mastodon.log assets/robots.txt /inline-script-checksum.json /assets/inline-script.js.map +/assets/icons.svg diff --git a/bin/build-svg.js b/bin/build-svg.js index 38179787..f575831e 100755 --- a/bin/build-svg.js +++ b/bin/build-svg.js @@ -28,13 +28,7 @@ async function main () { result = `\n${result}\n` - let html2xxFilepath = path.join(__dirname, '../templates/2xx.html') - let html2xxFile = await readFile(html2xxFilepath, 'utf8') - html2xxFile = html2xxFile.replace( - /[\s\S]+/, - '' + result + '' - ) - await writeFile(html2xxFilepath, html2xxFile, 'utf8') + await writeFile(path.resolve(__dirname, '../assets/icons.svg'), result, 'utf8') } main().catch(err => { diff --git a/routes/_components/Avatar.html b/routes/_components/Avatar.html index 47d9c27b..f73d0924 100644 --- a/routes/_components/Avatar.html +++ b/routes/_components/Avatar.html @@ -1,6 +1,6 @@ {#if error} {:elseif $autoplayGifs} {#if icon} - + {/if}

{title}

diff --git a/routes/_components/ExternalLink.html b/routes/_components/ExternalLink.html index b5bc9950..68a9bca1 100644 --- a/routes/_components/ExternalLink.html +++ b/routes/_components/ExternalLink.html @@ -5,7 +5,7 @@ class={computedClass}> {#if showIcon} - + {/if} \ No newline at end of file + diff --git a/routes/_components/dialog/components/ModalDialog.html b/routes/_components/dialog/components/ModalDialog.html index a3336078..68bc2c88 100644 --- a/routes/_components/dialog/components/ModalDialog.html +++ b/routes/_components/dialog/components/ModalDialog.html @@ -16,7 +16,7 @@ @@ -193,4 +193,4 @@ } } } - \ No newline at end of file + diff --git a/routes/_components/search/Search.html b/routes/_components/search/Search.html index 6acaa350..b12f7b60 100644 --- a/routes/_components/search/Search.html +++ b/routes/_components/search/Search.html @@ -9,7 +9,7 @@ @@ -74,4 +74,4 @@ } } } - \ No newline at end of file + diff --git a/routes/_components/settings/SettingsListItem.html b/routes/_components/settings/SettingsListItem.html index 92ee21cc..1aaf4089 100644 --- a/routes/_components/settings/SettingsListItem.html +++ b/routes/_components/settings/SettingsListItem.html @@ -2,7 +2,7 @@ {#if icon} - + {/if} @@ -70,4 +70,4 @@ offsetForIcon: void 0 }) } - \ No newline at end of file + diff --git a/routes/_components/status/StatusDetails.html b/routes/_components/status/StatusDetails.html index 07ac7e37..64aeb889 100644 --- a/routes/_components/status/StatusDetails.html +++ b/routes/_components/status/StatusDetails.html @@ -26,7 +26,7 @@ href="/statuses/{originalStatusId}/reblogs" aria-label={reblogsLabel}> - + {numReblogs} @@ -34,7 +34,7 @@ href="/statuses/{originalStatusId}/favorites" aria-label={favoritesLabel}> - + {numFavs} @@ -191,4 +191,4 @@ ExternalLink } } - \ No newline at end of file + diff --git a/routes/_components/status/StatusHeader.html b/routes/_components/status/StatusHeader.html index baa3583e..f910abf1 100644 --- a/routes/_components/status/StatusHeader.html +++ b/routes/_components/status/StatusHeader.html @@ -3,7 +3,7 @@ - +
@@ -124,4 +124,4 @@ } } } - \ No newline at end of file + diff --git a/routes/_components/status/StatusMediaAttachments.html b/routes/_components/status/StatusMediaAttachments.html index 1560bde6..26da6fc9 100644 --- a/routes/_components/status/StatusMediaAttachments.html +++ b/routes/_components/status/StatusMediaAttachments.html @@ -7,7 +7,7 @@ delegate-key={delegateKey} >
- +
@@ -23,7 +23,7 @@
- +
diff --git a/templates/2xx.html b/templates/2xx.html index f78572ad..ce72e8f7 100644 --- a/templates/2xx.html +++ b/templates/2xx.html @@ -5,7 +5,7 @@ - + @@ -49,49 +49,6 @@ html{scrollbar-face-color:var(--scrollbar-face-color);scrollbar-track-color:var( - - - - -Notifications -Local -Federated -Settings -Reply -Reply to thread -Boost -Favorite -More -Spinner -Empty user profile -Play -Show Sensitive Content -Hide Sensitive Content -Locked -Unlocked -Sealed Envelope -Stop Following -Follow -External Link -Search -Conversations -Paperclip -Thumbtack -List -Ban -Add media -Custom emoji -Content warning -Check -Delete -Follow requested -Compose -Close -Mute -Unmute -Link - -
%sapper.html%