robinmetral / brut

brut as in béton brut (early alpha, probably don't use it)
https://brut.pages.dev/
5 stars 0 forks source link

Expose mustache partials #33

Closed robinmetral closed 1 month ago

robinmetral commented 1 month ago

Closes #28, #32

This exposes mustache partials to users. Any file saved under a new partials directory (defaults to /partials, configurable) will be loaded and passed to the mustache engine at build time. Partials can be referenced in pages by their slugs, e.g. /partials/nav.html :point_right: {{ > nav }}.

It also comes with a breaking change for templates. Instead of saving template files anywhere and referencing them by their path (e.g. template: /templates/default.html), templates now must be saved to a new templates directory (defaults to /templates, configurable). They can be referenced in frontmatter by their slugs, e.g. /templates/default.html :point_right: template: default. Besides aligning the templates and partials APIs, one major benefit of this is that brut can load all templates once at the beginning of the build, instead of having to load them on the fly as their path is read from frontmatter. I expect significant build time improvements.

cloudflare-pages[bot] commented 1 month ago

Deploying brut with  Cloudflare Pages  Cloudflare Pages

Latest commit: 159d02c
Status: ✅  Deploy successful!
Preview URL: https://6b154789.brut.pages.dev
Branch Preview URL: https://partials.brut.pages.dev

View logs