Assets
Place static files in a template’s assets/ directory. They are served to the browser at render time and referenced from the body template with a relative ./assets/ (or assets/) path.
invoice/
template.html
assets/
styles.css
logo.svg
fonts/Inter.woff2<link rel="stylesheet" href="assets/styles.css">
<img src="assets/logo.svg" alt="logo">Reference vs. inline
You can either reference an asset by URL (above) or inline it into the HTML with the embed helpers (embed_text, embed_base64). Inlining avoids extra fetches and keeps the document self-contained:
<style>{{_ "."}}</style>
<img src="data:image/svg+xml;base64,{{embed_base64 "logo.svg"}}">Notes
- Assets are available to the body only — not to header/footer templates.
- Fonts placed in
assets/and referenced via@font-facerender correctly in the PDF (a common reason to prefer web fonts over system fonts). - Asset paths are resolved within the template directory; path traversal outside it is not permitted.
See the assets_template, embed_assets, and iframe examples in the Gallery.