diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-05-28 16:30:26 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-05-28 16:30:26 +0200 |
| commit | cd32a3ca0173676ed31486b5fa4dbd8c744cdec5 (patch) | |
| tree | a9d0888c7a0e425ef8006cc9aade5889b78c074c /src/frontend/Component.zig | |
| parent | e749e2ccf97e6e7a2d1c124c4e5bed688e4c06f2 (diff) | |
implement frontend framework
Diffstat (limited to 'src/frontend/Component.zig')
| -rw-r--r-- | src/frontend/Component.zig | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/src/frontend/Component.zig b/src/frontend/Component.zig deleted file mode 100644 index d90ed3b..0000000 --- a/src/frontend/Component.zig +++ /dev/null @@ -1,30 +0,0 @@ -const std = @import("std"); - -const File = @import("File.zig"); - -const Self = @This(); - -name: []const u8, -parent_dir: []const u8, - -pub fn path(p: []const u8) Self { - const name = p[if (std.mem.lastIndexOfScalar( - u8, - std.mem.trim(u8, p, "/"), - '/', - )) |index| index + 1 else 0..]; - - return .{ - .name = name, - .parent_dir = p, - }; -} - -pub fn to_html_string(comptime self: Self) []const u8 { - const html: File.Html = .minify(self.parent_dir ++ "/index.html"); - const js: File.Script = .minify(self.parent_dir ++ "/index.js"); - const css: File.Style = .minify(self.parent_dir ++ "/index.css"); - return "<template id=\"--" ++ self.name ++ "\">" ++ css.to_html_string() ++ html.to_html_string() ++ js.to_html_string() ++ "</template>"; -} - -test {} |