↓Skip to main content
Zeitgeist — a spike by Chris Gathercole
  1. Creators/
  2. Simon Willison — Creator of Datasette; co-creator of Django/

Inline rendering with document​.currentScript

Blog · Watch/Read · (gathered 2026-10-18)

  • Simon Willison highlights a “neat trick” by Lean Rada for inline rendering in HTML using document.currentScript.
  • The technique involves a tiny inline <script> element that replaces itself with dynamic content (e.g., the current year) when the page loads.
  • A shortcut function, $= (...n) => document.currentScript.replaceWith(...n), can be defined to create a “tiny template language” for more concise inline rendering directly within HTML.