CSS, JS and images beside the template, bundled per page, with groups and scope.
An alcove folder can hold more than templates. Every .css and .js file in it, also in subfolders, belongs to the alcove, and any other file (an image, a font) is copied to the site with a hash in its name. alcove.yaml and the .html and .xml files are templates and are not copied. assets: exclude: in alcove.yaml leaves out what you list.
A page does not link those files one by one. Alcove joins the stylesheets of every alcove on the page, layout first, into one file and the scripts into another, and links both at the end of the head. A page whose alcoves have no CSS or JS gets no bundle. The bundle tags carry data-alcoves, the names of the alcoves inside.
In a template, {{ asset:seal.svg }} is the hashed address of a file of that alcove, and url() in its CSS is rewritten the same way. A name that is no file stops the build.
Without more, CSS in an alcove applies to the whole page. scope: true wraps the alcove's markup in <alcove-scope> and its CSS in @scope, so a bare p or h3 rule reaches only that alcove. The stamp below does exactly that, and the paragraphs of this page do not change. Its script is wrapped in a function, so its variables are private, and it runs once per page even if the alcove is brought in again.
Live result This page is a static file, built once.
Stamped
This paragraph and heading are styled by the stylesheet in the alcove folder. The rest of the page keeps its own look.
0 stamps
The stamp above is one alcove. Its folder holds a template, a stylesheet, a script and an SVG. The tags this page got in its head for them:
Needs JavaScript to show.
The address of the image in the template above, after the build:
Needs JavaScript to show.
Source the files behind the result above
content/alcoves/demo_stamp/alcove.yaml
scope: true
data:
- label: Stamped
content/alcoves/demo_stamp/blueprint.html
<div class="stamp">
<img src="{{ asset:seal.svg }}" alt="" width="64" height="64">
<h3>{{ label }}</h3>
<p>This paragraph and heading are styled by the stylesheet in the alcove folder. The rest of the page keeps its own look.</p>
<div class="stamp-row"><button type="button" class="stamp-btn">Stamp</button> <span class="stamp-count">0 stamps</span></div>
</div>