Hacker News new | ask | show | jobs
by robinvdvleuten 192 days ago
Modern front-ends often need a tiny bit of server-rendered data to kick-start hydration or to configure a widget. The usual answer is an inline <script> that hydrates a global variable—but that approach triggers strict Content Security Policies, can’t be cached independently, and forces you to hand-roll parsing and error handling for every page. json-from-script smooths out that workflow by treating <script type="application/json"> tags as a simple, declarative data transport that is safe under CSP.