From b2f5f362071da00065388b1868b359c99763924a Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 10 Dec 2018 00:13:54 -0800 Subject: [PATCH] fix(svg): re-inline svg into html (#772) * Revert "fix(icons): fix icons.svg url (#769)" This reverts commit 1d34d45da7c9eaf5852f252101462dbd23adefb3. * Revert "perf: use prefetch instead of preload for svgs (#765)" This reverts commit b73dd548ae7160c648a1b7f9951accb5f62d56c2. * Revert "perf: build separate icons.svg file (#762)" This reverts commit ee45c07314ef5aac5412621ffe59ffc144fe1afa. * move svg to end of 2xx.html --- .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 | 48 ++++++++++++++++++- 21 files changed, 89 insertions(+), 38 deletions(-) diff --git a/.gitignore b/.gitignore index 167ac04..d668b5b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,3 @@ 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 f575831..3817978 100755 --- a/bin/build-svg.js +++ b/bin/build-svg.js @@ -28,7 +28,13 @@ async function main () { result = `\n${result}\n` - await writeFile(path.resolve(__dirname, '../assets/icons.svg'), result, 'utf8') + 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') } main().catch(err => { diff --git a/routes/_components/Avatar.html b/routes/_components/Avatar.html index 50ad976..47d9c27 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 78a18bd..b5bc995 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 9fe431a..a333607 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 3748a4c..6acaa35 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 ff59c46..92ee21c 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 fbbf81a..07ac7e3 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 96fa958..baa3583 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 58f088e..1560bde 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 a063333..1cf36ba 100644 --- a/templates/2xx.html +++ b/templates/2xx.html @@ -5,7 +5,7 @@ - + @@ -49,6 +49,7 @@ html{scrollbar-face-color:var(--scrollbar-face-color);scrollbar-track-color:var( +
%sapper.html%
@@ -59,6 +60,51 @@ 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 + + +