const std = @import("std"); const Component = @import("Component.zig"); const Head = @import("Head.zig"); const File = @import("File.zig"); const Self = @This(); components: []const Component, head: Head, styles: []const File.Style, contents: []const File.Html, pub const empty: Self = .{ .head = .empty, .components = &.{}, .styles = &.{}, .contents = &.{}, }; pub fn to_string(comptime self: Self) []const u8 { comptime var content: []const u8 = ""; content = content ++ comptime self.head.to_html_string(self.components, self.styles); content = content ++ ""; inline for (self.contents) |c| { content = content ++ comptime c.to_html_string(); } content = content ++ ""; return content; } test { const document: Self = comptime .{ .head = .default("test"), .components = &.{ .path("./web/hello-world"), }, .styles = &.{}, .contents = &.{.minify("./web/index.html")}, }; std.debug.print("{s}", .{document.to_string()}); }