Skip to content

JavaScript & web

JavaScript, TypeScript, React, Vue, CSS and static sites. 98 posts, newest first. All topics

  1. JavaScript & webBuilding and publishing a TypeScript library with Vite library modePackage a TypeScript library with Vite 8 library mode: ESM output, external dependencies, .d.ts files from tsc, an exports map, and testing the tarball before publishing.
  2. JavaScript & webVue 3 Frameworks in 2026, and What Changed in AstroWhere Nuxt, Quasar, VitePress, Pinia and Vue Router stand in late 2026, what Vite 8 changed under them, and the Astro 6 and 7 features this blog runs on.
  3. JavaScript & webVue 3 Six Years On: What Changed from 3.0 to 3.6Vue 3.0 shipped in September 2020. What each minor release added since, from script setup and defineModel to 3.5's reactivity rewrite and 3.6's Vapor Mode.
  4. JavaScript & webMaintaining a Legacy PHP CodebaseWhat it takes to keep the YellowSheet PHP site running, including upgrade attempts, Stripe, crons, tests and migrations.
  5. JavaScript & webRebuilding FriendlyUser: A Three.js Homepage and a Starlight BlogThe homepage is now a scroll-driven three.js city built from my career and every post on this blog, and the blog itself moved to Astro Starlight without changing a single post URL. Here is what changed, with before and after recordings.
  6. JavaScript & webWeb Streams in Node.js: ReadableStream, TransformStream and pipeToUse WHATWG streams in Node.js 24: create and iterate streams, split lines with TransformStream, parse fetch bodies, convert to Node streams, handle backpressure.
  7. JavaScript & webExplicit resource management in TypeScript with using and await usingHow using and await using work in TypeScript: Symbol.dispose, DisposableStack, tsconfig settings, Node 24 support, plus temp directory and SQLite transaction examples.
  8. JavaScript & webPage animations with the View Transitions APIAnimate DOM updates and page navigations: startViewTransition, view-transition-name, the pseudo-element tree, cross-document opt-in and reduced motion.
  9. JavaScript & webThe CSS :has() selector: styling parents and siblings without JavaScriptPractical :has() patterns: form validation states, cards with images, previous-sibling and quantity queries, plus the selector's rules, performance notes and support.
  10. JavaScript & webCSS size queries: components that respond to their own widthUse CSS container queries, container-type, named @container rules and cqi units to build a card that changes layout based on its slot, not the viewport.
  11. JavaScript & webTimeouts and cancellation for fetch with AbortSignalfetch has no timeout option. Use AbortController, AbortSignal.timeout and AbortSignal.any to cancel requests, tell timeouts from aborts, and clean up in React.
  12. JavaScript & webRunning TypeScript directly in Node.js with type strippingNode 22.18+ and 23.6+ run .ts files by erasing type annotations. What syntax works, what doesn't, the tsconfig settings to match, and why you still need tsc.
  13. JavaScript & webTemplate literal types in TypeScript: typed routes and event namesUse template literal types and infer to pull params out of route strings like /users/:id, build typed event names, and know where the type checker gives up.
  14. JavaScript & webBranded types in TypeScript: keeping IDs and units apartUse branded types to stop TypeScript mixing up user IDs and order IDs, or cents and dollars: constructor functions, type guards, JSON and Zod's .brand().
  15. JavaScript & webValidating untrusted input at runtime with Zod 4Use Zod 4 schemas to validate request bodies and environment variables in TypeScript: z.infer, safeParse, coercion, transforms and readable error output.
  16. JavaScript & webDiscriminated unions and exhaustive checks in TypeScriptModel request states and webhook events as discriminated unions, narrow them by a tag field, catch missing cases with never, and parse unknown JSON into a union.
  17. JavaScript & webThe satisfies operator in TypeScript: checking values without widening themHow satisfies checks an object against a type while keeping its precise inferred type, with config maps, Record keys, as const satisfies and the gotchas.
  18. JavaScript & webWebAssembly for web developers: what it's good at and when to skip itWhat WebAssembly gives a web app (fast compute, reuse of C, C++ and Rust code, a sandbox) and what it costs, with a minimal module called from JavaScript.
  19. JavaScript & webByte buffers in Deno with @std/io BufferHow the Buffer class from @std/io works in Deno: writing and reading bytes, filling it from a file, and when to use web streams instead.
  20. JavaScript & webWebSockets in Deno: an echo server and clientBuild a WebSocket echo server in Deno with Deno.serve and Deno.upgradeWebSocket, and connect to it with the built-in WebSocket client.
  21. JavaScript & webSubscribing a customer to a Clover recurring plan with PHPUse Clover's sandbox APIs from PHP to tokenize a card, create a customer with a card on file, look up a tax rate, and subscribe them to a recurring plan.
  22. JavaScript & webFive ways to add search to a website: Algolia, Fuse.js, Google, PHP and PagefindWorking examples of site search with Algolia, Fuse.js in React, Google Programmable Search, a PHP and MySQL query, and Pagefind for static sites.
  23. JavaScript & webKeeping an element above the fold in React with refs and getBoundingClientRectMeasure where an element ends up on the page with a React ref and getBoundingClientRect, then shift it up with a negative top offset so it stays above the fold.
  24. JavaScript & webGetting started with react-spring: useSpring and useTrail examplesThree small react-spring examples (a fade-in, a slide and a staggered trail) using the current @react-spring/web package and the .to() API.
  25. JavaScript & webBuilding a custom WordPress theme: files, the Loop, and publishingNotes from building a rough Tailwind-styled WordPress theme, covering the theme files, a post-card Loop, its bugs, and where to publish it.
  26. JavaScript & webAn endless road animation for a car in React and CSSMake a car look like it is driving forever by scrolling dashed road markings with a CSS keyframe animation inside a small React component.
  27. JavaScript & webRemoving carrier-deactivated numbers with Twilio's Deactivations API and BullMQA daily BullMQ job in Node.js that downloads Twilio's list of carrier-deactivated US numbers and removes them from your subscriber list.
  28. JavaScript & webAn IP address lookup API in LaravelA small Laravel JSON API that validates IP addresses, looks them up through an external service with the HTTP client, and caches the results with Eloquent.
  29. JavaScript & webMermaid diagrams from text: flowcharts, sequence, Gantt, class, state and ER examplesWrite flowcharts, sequence diagrams, Gantt charts, class, state and ER diagrams as text with Mermaid, plus theming, click links, and rendering in pages or the CLI.
  30. JavaScript & webFinding and removing broken links with the Fetch APIUse fetch() HEAD requests to find links that return 4xx or 5xx errors, remove them from a page in the browser, or check them from Node.js.
  31. JavaScript & webWhat Laravel is and how to start a project with itA short introduction to Laravel, the PHP web framework, covering what it includes, how to create a new app, and how routes work.
  32. JavaScript & webHow to make images load faster on a websitePractical ways to cut image weight on a web page, covering format choice, compression, srcset and sizes, lazy loading, layout shift and CDNs.
  33. JavaScript & webAdd an "Open in Overleaf" button in HTML or ReactBuild a link that opens a public .tex file as a new Overleaf project, as a plain HTML anchor, a Python helper, and a reusable React component.
  34. JavaScript & webPorting my LaTeX diagrams site from Saber to NextraHow I moved my LaTeX diagrams site from the Vue-based Saber generator to Nextra on Next.js, with the config files I used and the migration steps.
  35. JavaScript & webClustering map markers in React Native with superclusterBuild a clustered MapView for react-native-maps with supercluster: group nearby markers, show a count bubble, and zoom in when a cluster is tapped.
  36. JavaScript & webAdd a Google Map with a marker to a web page using the Maps JavaScript APIGet an API key, load the Google Maps JavaScript API, and render a map with an advanced marker in a plain HTML page.
  37. JavaScript & webNetworked Phaser game, part II: the browser clientThe Phaser 2 browser client for a multiplayer pirate ship game: input, Socket.IO sync with the Node server, interpolation, collisions and health.
  38. JavaScript & webMultiplayer Phaser game, part I: the Node.js and Socket.IO serverHow the server for my Phaser pirate-ship game tracks players, bullets, health packs and driftwood, and broadcasts state with Express and Socket.IO.
  39. JavaScript & webWebAssembly for AR and VR on the web: where it fits with WebXRWhat WebAssembly does and doesn't do for browser AR/VR: how it works with WebXR and WebGL, which engines export to it, and the gotchas to plan for.
  40. JavaScript & webDownloading League of Legends match history with Deno and the Riot APIA Deno script that pages through a player's League of Legends match IDs with Riot's match-v5 API, plus why custom games don't show up.
  41. JavaScript & webA React image component with a loading skeleton and fallback imageBuild a React image component that shows a shimmer skeleton while the image loads and swaps to a fallback image if it fails, without error loops.
  42. JavaScript & webNode.js 18: built-in fetch and the node:test runnerTwo Node.js 18 additions that replace npm packages: a global fetch() enabled by default, and the built-in node:test test runner.
  43. JavaScript & webTesting in Deno with Deno.test and @std/assertWrite and run tests in Deno with Deno.test and @std/assert: async tests, test steps, permissions, filtering, parallel runs and coverage.
  44. JavaScript & webBuilding a responsive price card component in ReactHow I built a React price card with an image, nightly price, host and total, then made it responsive with a media query and added a hover zoom in CSS.
  45. JavaScript & webBuilding a command-line app in TypeScript with Commander.jsSet up a TypeScript project, define commands, arguments and options with Commander.js, compile with tsc, and install the result as a runnable CLI.
  46. JavaScript & webBuilding a Caesar cipher component in Vue 3A small Vue 3 single-file component that encrypts and decrypts text with a Caesar shift, including handling negative and large shift values.
  47. JavaScript & webWhy JavaScript's Date is painful, and what to use insteadWhere the built-in Date object trips you up with time zones and parsing, and how Intl, Temporal, Moment Timezone and date-fns-tz handle the same conversions.
  48. JavaScript & webCSS-in-JS vs plain CSS in React, with styled-components examplesThe trade-offs between runtime CSS-in-JS and plain CSS or CSS Modules in React, with working styled-components examples and its 2025 maintenance-mode status.
  49. JavaScript & webFade elements in on scroll with CSS transitions and react-intersection-observerUse the useInView hook from react-intersection-observer to add a CSS class when an element scrolls into view, and animate it with a CSS transition.
  50. JavaScript & webCSS animations in Vue 3: keyframes, class bindings and TransitionGroupAnimate Vue 3 components with CSS keyframes, toggle animations with class bindings, and animate list items with TransitionGroup and its CSS classes.
  51. JavaScript & webStatic site generators compared: Jekyll, Hugo, Gatsby, Next.js, Eleventy, VuePress, Astro and GridsomeWhat a static site generator does, and the trade-offs between Jekyll, Hugo, Gatsby, Next.js, Eleventy, VuePress/VitePress, Astro and Gridsome.
  52. JavaScript & webChecking, requesting, and revoking permissions in DenoHow Deno's permission flags work and how to check, request, and revoke permissions at runtime with the built-in Deno.permissions API.
  53. JavaScript & webGetting started with Remix: loaders, actions, and the move to React RouterHow Remix's loaders, actions, and nested routes work, how it compares to Next.js, and how to start the same app today with React Router framework mode.
  54. JavaScript & webThe deno CLI: run, fmt, lint, check, bundle and compileA tour of the deno CLI: running TypeScript with permission flags, then formatting, linting, type-checking, bundling and compiling a small script.
  55. JavaScript & webRunning C numerical code in the browser with WebAssembly and EmscriptenCompile a C dot-product function to WebAssembly with Emscripten, pass Float64Array data through Wasm memory, and see where Wasm fits for scientific code.
  56. JavaScript & webReact class components: state, props, events and lifecycle methodsHow to write React class components with state, props, event handlers, lifecycle methods and TypeScript types, and when you still need one.
  57. JavaScript & webNext.js basics: rendering modes, a TypeScript starter app and deploying to VercelWhat Next.js adds on top of React, how to create a TypeScript app with the App Router, the built-in components worth using, and how to deploy it to Vercel.
  58. JavaScript & webSharing state across React components with ContextHow to use createContext and useContext to share state without prop drilling, with counter, theme toggle and viewport-size examples, and how context re-renders work.
  59. JavaScript & webReact function components: props, hooks, events and TypeScriptWrite React function components, manage state and effects with hooks, handle events and forms, and type props in TypeScript.
  60. JavaScript & webReact UI libraries and app basics: MUI, React-Bootstrap, routing, Redux and testsAdd MUI or React-Bootstrap to a Vite React app, then wire up controlled forms, React Router, Redux Toolkit, Vitest tests and a Vercel deploy.
  61. JavaScript & webHTTP requests in Deno with fetchMake HTTP requests in Deno with the built-in fetch: GET and POST, error handling, timeouts, streaming a download to disk, and Deno-specific options.
  62. JavaScript & webConverting React inline style objects to CSS classes with ChatGPTWhy moving React inline style objects into CSS classes helps, and how I used ChatGPT to turn a camelCase style object into a CSS rule.
  63. JavaScript & webPage transitions in Next.js: Motion in the Pages Router, ViewTransition in the App RouterFade between routes in Next.js with Motion's AnimatePresence in the Pages Router, or React's ViewTransition component in the App Router.
  64. JavaScript & webThe Deno standard library: using @std packages from JSRWhat the Deno standard library is, how to install its @std packages from JSR, and examples from @std/fs, @std/http, @std/datetime and @std/uuid.
  65. JavaScript & webSVG wave hero section for an investing homepage with Vue and VuesaxGenerating SVG wave paths in a Vue component, and building an animated wave hero section for an investing blog homepage with Nuxt 2 and Vuesax.
  66. JavaScript & webHTTP in Deno: servers with Deno.serve, requests with fetch, and @std/httpHow to build HTTP servers in Deno with Deno.serve, make requests with fetch, stream files, and serve static directories with @std/http.
  67. JavaScript & webHow I style SVG icons in Next.js: inline fetch plus CSS modulesA small React component that fetches an SVG file and inlines it, so a CSS module can recolour the icon's paths when it is toggled.
  68. JavaScript & webDumb bug fixes that shouldn't have workedA running list of bug fixes that shouldn't have worked but did, starting with a PHP 5.2 session bug fixed by re-uploading the same file to cPanel.
  69. JavaScript & webBuilding a scripted chat bot in React with react-simple-chatbotA small scripted "about me" chat bot built with react-simple-chatbot, where each step shows a message or a set of options that decide the next step.
  70. JavaScript & webWhat package.json does in a Node.js project, with an Express exampleThe main package.json fields (name, version, scripts, dependencies, devDependencies) and how to add a start script for a small Express server.
  71. JavaScript & webParsing and writing YAML in Deno with @std/yamlHow to parse, edit and write YAML in Deno with @std/yaml from JSR, including typing the parsed result and a couple of YAML gotchas.
  72. JavaScript & webBuilding a URL shortener dapp with Solidity, Nuxt and ethersHow my Nuxt URL shortener stored links in a Solidity contract, created them through MetaMask with ethers.js, and redirected short IDs to the stored URL.
  73. JavaScript & webReact Navigation basics: stacks, params, tabs, deep links and transitionsSet up React Navigation 7 in a React Native app, pass params between screens, nest a stack in tabs, handle deep links and change screen transitions.
  74. JavaScript & webTracking IPFS files with a Solidity contract and a Drizzle React tableAn old dapp of mine: a Solidity contract that records IPFS hashes and tags per owner, a simple sign-up contract, and a Drizzle React table that lists the files.
  75. JavaScript & webA simple collapsible component in React and TypeScriptA small React function component that shows or hides its content when you click the header, with a CSS-only caret and no icon library.
  76. JavaScript & webAstrodon: a Tauri-based desktop app framework for Deno (unmaintained)What Astrodon was, how its webview windows and Deno messaging worked, why it no longer runs, and what to use for Deno desktop apps instead.
  77. JavaScript & webBuilding a small web server in Deno with Pogo: routes, static files and JSXUse Pogo, a hapi-style Deno web framework, to define routes, serve static files with h.directory() and render HTML from JSX.
  78. JavaScript & webGetting started with Fresh 2 in Deno: routes, handlers and islandsCreate a Fresh 2 app in Deno and add a file-based route with a data handler, a JSON API route and an interactive Preact island.
  79. JavaScript & webBuilding a command-line app in Deno with cacUse the cac CLI library from npm in Deno to define commands and options, print help and version output, and reject unknown commands.
  80. JavaScript & webDesktop automation in Deno with autopilot: mouse, keyboard and screenshotsHow the autopilot module drives the mouse, keyboard and screen from Deno through Rust FFI, with a working example and its permission flags.
  81. JavaScript & webBuild a to-do list with Next.js API routes and Neon PostgresA Next.js to-do app with an MUI frontend, SWR data fetching, Pages Router API routes, and a Neon Postgres database accessed through node-postgres.
  82. JavaScript & webSetting up a VuePress 1 site with vuepress-theme-coolInstall VuePress 1 and vuepress-theme-cool, configure KaTeX, PlantUML and admonition plugins, and run a local documentation site.
  83. JavaScript & webvuepress-theme-cool, a VuePress 1 theme with Mermaid, charts and admonitionsHow vuepress-theme-cool extends the VuePress 1 default theme with Mermaid diagrams, a pros/cons component, Chart.js charts, sortable tables and admonitions.
  84. JavaScript & webAsync JavaScript: promises, async/await and fetchHow promises and async/await work in JavaScript, plus making HTTP requests with fetch, handling errors, cancelling with AbortController and caching responses.
  85. JavaScript & webRunning an Express server in a Docker containerWrite a Dockerfile for a small Express app, build the image, and run it with the port mapped to your machine.
  86. JavaScript & webInstall Node.js and run your first Express serverInstall Node.js on Windows, macOS or Linux, then build a minimal Express 5 server with a start script and static file hosting.
  87. JavaScript & webIntroduction to JavaScript: a free ebook on JS, Node.js and promisesAn introductory ebook on JavaScript, Node.js and asynchronous programming, written in LaTeX and published on Amazon KDP, with a free PDF copy.
  88. JavaScript & webOverview of corporate landing page done in react with microsoft fabric uimaking a corporate landing page in react
  89. JavaScript & webUsing remotion for game highlightsAs I hit titan in erbs I wanted to make a video of the highlights
  90. JavaScript & webUpgrading from material v4 to mui v5Updating material ui components to the latest version
  91. JavaScript & webAdding search to static sites with pagefindSearching for content using pagefind, I will cover how I added it to my static site.
  92. JavaScript & webHow to consume twilio conversations mediaA simple explaination of how I consume twilio conversation media
  93. JavaScript & webExtracting types automatically from typescript-axios openapi generatorMy Thoughts on what todo with jcenter/bintray going down.
  94. JavaScript & webHow to use resolutions in package.jsonUsing resolutions in package.json
  95. JavaScript & webScreenshot utility for mobile appsThis covers how to take screenshots of your mobile app using the ios simulator or android.
  96. JavaScript & webHow to add tags to astroHow I implemented tags for my blog
  97. JavaScript & webHow to make a show more component in reactHow I implemented tags for my blog
  98. JavaScript & webUpdating Vuepress Theme CoolVuepress-theme-cool 1.7

© 2026 David Li · Home · Blog · RSS ·Classic site · Built with Astro, Starlight and three.js · Logos:Font Awesome Free (CC BY 4.0)