Documentation channel: current development main at compiler checkpoint 1d7e15e. The latest tagged release is v0.0.3; pages identify APIs that are not yet released.
Embedded resources
Strut can compile files and directories into the generated executable. Literal embed paths are read at compile time, so the deployed program does not need the original asset files.
Embed one file
page := embed_file("public/index.html");
Embed a directory
embed_dir() returns a map from relative paths to embedded byte strings. Files are enumerated in deterministic path order during compilation.
assets := embed_dir("public");
print(assets["app.js"]);
Serve embedded assets
The HTTP server can serve an embedded asset map directly. Paths are normalized defensively, traversal attempts are rejected, common MIME types are detected, and responses receive ETag and cache headers.
assets := embed_dir("public");
http_server app := http_server();
app.static("/", assets, "index.html");
app.listen("127.0.0.1", 8080);
Incremental builds
Embedded files are build dependencies. The persistent object build system records them in per-object .strut/info metadata, so changing an embedded asset invalidates the affected object on the next build.
