Skip to content

Commit

Permalink
docs: update manifest tranform for future-proof
Browse files Browse the repository at this point in the history
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
  • Loading branch information
userquin and benmccann authored Dec 1, 2021
1 parent 148500d commit 61afed2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions docs/frameworks/sveltekit.md
Original file line number Diff line number Diff line change
@@ -159,10 +159,16 @@ const pwaConfiguration = {
).map((e) => {
let url = e.url;
if (url && url.endsWith('.html')) {
if (url.startsWith('/'))
if (url.startsWith('/')) {
url = url.slice(1)

e.url = url === 'index.html' ? '/' : `/${url.substring(0, url.lastIndexOf('/'))}`
}
if (url === 'index.html') {
e.url = url === 'index.html' ? '/'
} else if (url.endsWith('index.html')) {
e.url = `/${url.substring(0, url.lastIndexOf('/'))}`
} else if (url.endsWith('.html')) {
e.url = `/${url.substring(0, url.length - '.html'.length)}`
}
}

return e

0 comments on commit 61afed2

Please sign in to comment.