News for hackers. Stuff that matters.
Re:VanJS: A 0.9KB JavaScript UI framework by nicoburns on Wednesday December 20, 2023 @05:41PM (#38714627)
Have you used esbuild? It’s a transpiler without the faff.
Re:VanJS: A 0.9KB JavaScript UI framework by simonw on Wednesday December 20, 2023 @05:59PM (#38714788)
I've used it via Vite, and it worked fine.

I did write myself EXTENSIVE notes such that when I return to that project in the future I have a fighting change of figuring out how to build it again: https://til.simonwillison.net/github-actions/vite-github-pag...

Re:VanJS: A 0.9KB JavaScript UI framework by c-hendricks on Wednesday December 20, 2023 @11:02PM (#38716861)
You can trim down those notes a lot, like instead of `npm install`, I write a shell script called `script/prepare-env`, instead of various scripts written in a package.json file, I've standardized on `script/start`, `script/build`, and `script/deploy`. Now, no matter the language or package manager used, my workflow is the same.

And you could clean up the GitHub Actions file by just passing the base url to your build script, IE `BASE_URL="/${{ github.event.repository.name }}/" script/build`.

I mean no offense, these notes aren't that extensive, and most of the content is for setting up GitHub Actions / GitHub Pages. npm install / npm run dev / npm run build aren't very esoteric, and can all be documented inside the repo.

I'm actually a little shocked to find out you're a co-creator of Django.

Re:VanJS: A 0.9KB JavaScript UI framework by simonw on Thursday December 21, 2023 @12:22AM (#38717262)
The title of that page is "Serving a JavaScript project built using Vite from GitHub Pages" - that's what those notes are meant to cover, the Vite part is a subset of what I learned in that particular TIL.

Thanks for the BASE_URL environment variable trick - that was very non-obvious to me! I found the documentation for that just now: https://vitejs.dev/guide/env-and-mode

I'm not sure what you mean by "trim down" those notes - if anything I'm always looking for ways to bulk this kind of document up, in order to capture as many of the details of how things work as possible.

I tried the script/x pattern for a bit but I've found that Justfiles fit my brain better - I have a TIL about those here: https://til.simonwillison.net/django/just-with-django