HeadlinesBriefing favicon HeadlinesBriefing.com

Astro’s New Zero‑Build Policy Workflow Cuts Friction

Hacker News •
×

Astro developers can now generate privacy, terms and cookie pages without a Vite plugin, thanks to OpenPolicy’s core SDK. By defining a single JSON‑style config in src/lib/openpolicy.ts, the library compiles policies directly in page frontmatter, eliminating intermediate files and build‑time watchers.

The old integration required adding @openpolicy/astro, configuring outDir, and maintaining a generated folder in git. The updated method drops the plugin, reduces dependencies to three packages, and removes any .gitignore entries. Policies are rendered to static HTML at build time, so no JavaScript reaches the browser.

A typical privacy page imports compile, expandOpenPolicyConfig, and renderHTML from the SDK, then injects the resulting HTML via set:html. The same pattern works for terms and cookie policies, keeping the Astro config clean and the build pipeline straightforward.

Overall, the shift streamlines policy management for Astro projects, removes unnecessary tooling, and keeps compliance code lightweight while preserving the original static‑HTML output.