Simon Willison·· 2 日前AIスコア14
document.currentScriptによるインラインレンダリング
Inline rendering with document.currentScript
AIによる概要
Lean Radaが、document.currentScriptプロパティを使ってインラインのスクリプトをその場で描画に置き換える手法を紹介している。`$=(...n)=>document.currentScript.replaceWith(...n)` というショートカット関数を定義すると、小さなテンプレート言語として使える。
出典: Simon Willison · simonwillison.net