Skip to content

Small fixes (updated bootstrap, fixed mismatched HTML tags, etc)#4

Merged
MarinX merged 9 commits intoMarinX:mainfrom
LunarEclipse363:main
Mar 7, 2025
Merged

Small fixes (updated bootstrap, fixed mismatched HTML tags, etc)#4
MarinX merged 9 commits intoMarinX:mainfrom
LunarEclipse363:main

Conversation

@LunarEclipse363
Copy link
Copy Markdown
Contributor

@LunarEclipse363 LunarEclipse363 commented Feb 11, 2025

And by "small fixes" I mean:

  • Updated Bootstrap to v5.3.3
    • The previously used stylesheet for the previous version was deleted from github apparently (and only exists on the CDN, why?)
    • The new version natively supports multiple color schemes
    • But supporting @media(prefers-color-scheme) requires a bunch of extra JS (janky)...
    • ... or a custom build of Bootstrap (my choice)
    • So I ended up spending a day learning how to do that
    • And ended up with PNPM + Vite for building this
    • So it's more complex than before but no longer depends on an external CDN because it's all just bundled together.
  • Ran index.html through Prettier (opinionated but consistent code formatter)
  • Revamped the Makefile so you can keep running make build and only the steps that have to be re-done will be re-done (the weird parts of the code that I wouldn't guess from skimming the gnu make manual are explained in comments)
    • This includes make help which prints help for all the PHONY targets based on comments and it was just a fun random idea to implement
  • Fixed some mismatched tags in index.html (were </a>, should be </button>)
  • All the code from cf118ca was removed when I moved to a custom build of bootstrap but that commit added subresource integrity for the existing stylesheet
  • The WASM/Go stuff is now output to vendor/ before being bundled by Vite later on in the build process
  • All the web source code is in src/ (index.html etc.)
  • All the static assets are in src/public/ (they get put in the website root, favicon.ico etc.)
  • The output is in dist/ (I followed the convention from one of the tools I used)
  • You can check the metadata in package.json, I hope it's all correct, also that's another place that contains the package version now
  • To get a more useful diff for index.html, first look at the diff until the commit that applies Prettier and then look at the diff after the commit that applies Prettier
    • but in summary:
    • 2d9eb36 fixes two typos (I found them cause Prettier complained about a syntax error, web browsers correct these automatically at runtime)
    • cf118ca is obsolete now but it added a checksum for the stylesheet
    • 6365608 removed some random empty lines and moved the main script into <head> and is now also kinda obsolete because all scripts are moved into src/main.js
    • 411246c is literally just running a code formatter (Prettier) with no actual changes, I decided to do that as a separate commit so the diffs for individual commits make sense (please don't squash that)
    • 1e3c3ce is the commit where I got carried away and so all the scripts are removed from index.html and put into src/main.js, and Vite does some magic with that to bundle it into one output JS file that works (I don't fully understand JS bundlers honestly, I used Vite because bootstrap tells you how to use it to get a customized build)
  • pnpm-lock.yaml is autogenerated by PNPM (afaik you're supposed to include lock files in source control for binary software)
  • I adjusted the .gitignore to match all the above changes
  • added a pnpm run format script for running prettier on the relevant files (JS/HTML/SCSS)
  • added information about running a Vite dev server to README (it has live updates!, pnpm run dev)

The `<script type="module">` is required for the inline script to
execute *after* the rest of the page is loaded.
Bootstrap v5.3 supports multiple color schemes. However by default it
doesn't support @media(prefers-color-scheme). So I went into the rabbit
hole of "how to build a custom bootstrap version" and ended up
overhauling a lot of this project, using PNPM for dependency management
and Vite for building the scss/js and bundling. Somehow you can still
build this with `make build`.
@LunarEclipse363 LunarEclipse363 marked this pull request as ready for review February 11, 2025 19:49
@LunarEclipse363
Copy link
Copy Markdown
Contributor Author

(fixed a typo where I used a _ instead of -)

@MarinX
Copy link
Copy Markdown
Owner

MarinX commented Feb 11, 2025

damn, those are really small fixes 🤣 and thank you for the PR.
I will checkout the branch, review and test it first before merging.
Keep you posted, but this looks good!

@LunarEclipse363
Copy link
Copy Markdown
Contributor Author

I tried deploying it and realized I forgot to copy the favicon into dist (gonna fix it later, but you can see it at https://encrypt.lunareclipse.zone)

@MarinX MarinX self-assigned this Mar 7, 2025
@MarinX MarinX merged commit 943c355 into MarinX:main Mar 7, 2025
@MarinX
Copy link
Copy Markdown
Owner

MarinX commented Mar 7, 2025

Thank you @LunarEclipse363 👍
Released as v1.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants