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/File.zig | |
| parent | e749e2ccf97e6e7a2d1c124c4e5bed688e4c06f2 (diff) | |
implement frontend framework
Diffstat (limited to 'src/frontend/File.zig')
| -rw-r--r-- | src/frontend/File.zig | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/frontend/File.zig b/src/frontend/File.zig deleted file mode 100644 index fac6a03..0000000 --- a/src/frontend/File.zig +++ /dev/null @@ -1,41 +0,0 @@ -const Minifier = @import("Minifier.zig"); - -pub fn File(comptime tag: ?[]const u8, comptime minifier: Minifier) type { - const opening = if (tag) |t| "<" ++ t ++ ">" else ""; - const closing = if (tag) |t| "</" ++ t ++ ">" else ""; - - return struct { - file: []const u8, - do_minify: bool, - - pub fn path(comptime p: []const u8) @This() { - return .{ - .file = p, - .do_minify = false, - }; - } - - pub fn minify(comptime p: []const u8) @This() { - return .{ - .file = p, - .do_minify = true, - }; - } - - pub fn to_html_string(comptime self: @This()) []const u8 { - return opening ++ (if (self.do_minify) - minifier.minify(@embedFile(self.file)) - else - @embedFile(self.file)) ++ closing; - } - }; -} - -/// When using regex in Javascript the spaces -/// might get trimmed since /re/ is a awful syntax -/// I don't what to add a rule for it currently, -/// Since a single `/` is a operator but if there are two on one line -/// it is a regex. -pub const Script = File("script", .js); -pub const Style = File("style", .css); -pub const Html = File(null, .html); |