Simon Willison·· 18일 전AI 점수14
document.currentScript를 이용한 인라인 렌더링
Inline rendering with document.currentScript
AI 요약
Lean Rada가 document.currentScript 속성을 이용해, 인라인 스크립트를 그 자리에서 렌더링 결과로 바꾸는 기법을 소개했다. `$=(...n)=>document.currentScript.replaceWith(...n)` 같은 단축 함수를 정의하면 작은 템플릿 언어처럼 쓸 수 있다.
출처: Simon Willison · simonwillison.net