Figuring out vite building (no vite building)

This commit is contained in:
marleyrae 2023-06-10 14:49:15 -07:00
parent 46b3bd1d85
commit 7775f3016d
4 changed files with 34 additions and 35 deletions

59
menu.js
View file

@ -1,39 +1,40 @@
/* -------------------------------------------------------------------------------------- find and import config ---- */
const siteRoot = '/' + location.pathname.split('/')[1]
const {wayback} = await import(/* @vite-ignore */`${siteRoot}/config.js`)
/* --------------------------------------------------------------------------------------------- import menu css ---- */ /* --------------------------------------------------------------------------------------------- import menu css ---- */
import '/style/menu.css' import '/style/menu.css'
/* -------------------------------------------------------------------------------------------------- build menu ---- */ /* -------------------------------------------------------------------------------------------------- build menu ---- */
let menu = document.createElement('div')
menu.id = 'archive-menu'
let span = document.createElement('span') (async () => {
span.id = 'hrt' const siteRoot = '/' + location.pathname.split('/')[1]
span.innerText = '♥' const {wayback} = await import(/* @vite-ignore */`${siteRoot}/config.js`)
menu.append(span)
let archiveRoot = document.createElement('a') let menu = document.createElement('div')
archiveRoot.setAttribute('href', '/') menu.id = 'archive-menu'
archiveRoot.setAttribute('target', '_top')
archiveRoot.innerText = 'Home'
menu.append(archiveRoot)
let changelog = document.createElement('a') let span = document.createElement('span')
changelog.setAttribute('href', `/${siteRoot}/CHANGELOG.txt`) span.id = 'hrt'
changelog.setAttribute('target', '_blank') span.innerText = '♥'
changelog.innerText = 'Changelog' menu.append(span)
menu.append(changelog)
if (wayback) { let archiveRoot = document.createElement('a')
let waybackLink = document.createElement('a') archiveRoot.setAttribute('href', '/')
waybackLink.setAttribute('href', `https://web.archive.org/web/${wayback}`) archiveRoot.setAttribute('target', '_top')
waybackLink.setAttribute('target', '_blank') archiveRoot.innerText = 'Home'
waybackLink.innerText = 'Wayback Capture' menu.append(archiveRoot)
menu.append(waybackLink)
}
document.body.prepend(menu) let changelog = document.createElement('a')
changelog.setAttribute('href', `/${siteRoot}/CHANGELOG.txt`)
changelog.setAttribute('target', '_blank')
changelog.innerText = 'Changelog'
menu.append(changelog)
if (wayback) {
let waybackLink = document.createElement('a')
waybackLink.setAttribute('href', `https://web.archive.org/web/${wayback}`)
waybackLink.setAttribute('target', '_blank')
waybackLink.innerText = 'Wayback Capture'
menu.append(waybackLink)
}
document.body.prepend(menu)
})()

View file

@ -4,8 +4,6 @@
"vite": "^4.3.9" "vite": "^4.3.9"
}, },
"scripts": { "scripts": {
"dev": "vite", "dev": "vite"
"build": "vite build",
"preview": "vite preview"
} }
} }

View file

@ -9,8 +9,8 @@ export default defineConfig({
build: { build: {
rollupOptions: { rollupOptions: {
input: Object.fromEntries( input: Object.fromEntries(
globSync('**/index.html').map(file => [ globSync('!(dist)/**/*.html').map(file => [
relative('saudade', file.slice(0, file.length - extname(file).length)), relative('saudade', file.slice(0, file.length - extname(file).length)).slice(3),
resolve(__dirname, file), resolve(__dirname, file),
]), ]),
), ),

View file

@ -167,7 +167,7 @@
<a href="breeds/c_wildz.html" title="Wildz (Catz)">Wildz (Catz)</a><br> <a href="breeds/c_wildz.html" title="Wildz (Catz)">Wildz (Catz)</a><br>
<a href="breeds/c_fantasyz.html" title="Fantasyz (Catz)">Fantasyz (Catz)</a><br> <a href="breeds/c_fantasyz.html" title="Fantasyz (Catz)">Fantasyz (Catz)</a><br>
<a href="breeds/forestfolk.html" title="Forest Folk">Forest Folk</a><br> <a href="breeds/forestfolk.html" title="Forest Folk">Forest Folk</a><br>
<a href="breeds/catzdogz.html" title="Catz Dogz">Catz << >> Dogz</a><br> <a href="breeds/catzdogz.html" title="Catz Dogz">Catz &lt;&lt; &gt;&gt; Dogz</a><br>
<a href="breeds/caninez.html" title="Caninez">Caninez</a><br> <a href="breeds/caninez.html" title="Caninez">Caninez</a><br>
<a href="breeds/d_wildz.html" title="Wildz (Dogz)">Wildz (Dogz)</a><br> <a href="breeds/d_wildz.html" title="Wildz (Dogz)">Wildz (Dogz)</a><br>
<a href="breeds/d_fantasyz.html" title="Fantasyz (Dogz)">Fantasyz (Dogz)</a><br> <a href="breeds/d_fantasyz.html" title="Fantasyz (Dogz)">Fantasyz (Dogz)</a><br>