Simple example of embedding Kiesel in Zig code
| .forgejo/workflows | ||
| src | ||
| .gitignore | ||
| build.zig | ||
| build.zig.zon | ||
| LICENSE | ||
| README.md | ||
Kiesel Zig Example
This repository contains a minimal example of how to embed the Kiesel JS engine in Zig code.
The basic steps are:
-
Declare dependency in
build.zig.zon:.{ // ... .dependencies = .{ // ... .kiesel = .{ .url = "https://codeberg.org/kiesel-js/kiesel/archive/<commit hash>.tar.gz", .hash = "<package hash>", }, }, } -
Add the module to your executable or library in
build.zig:const kiesel = b.dependency("kiesel", .{ .target = target, .optimize = optimize, // Enabled by default, reduces size if you don't need `Intl` or `Temporal` .@"enable-intl" = false, .@"enable-temporal" = false, }); // ... exe.root_module.addImport("kiesel", kiesel.module("kiesel")); -
Use it! See
src/main.zigfor a basic example, runzig build runto try it out.