From 548a8bb2b1828513d5e8f32f06238d1e0bff86c1 Mon Sep 17 00:00:00 2001 From: Ankit Patial Date: Wed, 28 Jan 2026 22:54:23 +0530 Subject: [PATCH] fix: simplify compile_tpls export in root.zig for dependency usage --- src/root.zig | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/root.zig b/src/root.zig index 7464e4c..d30bff0 100644 --- a/src/root.zig +++ b/src/root.zig @@ -5,8 +5,6 @@ // const engine = pugz.ViewEngine.init(.{ .views_dir = "views" }); // const html = try engine.render(allocator, "index", .{ .title = "Home" }); -const builtin = @import("builtin"); - pub const pug = @import("pug.zig"); pub const view_engine = @import("view_engine.zig"); pub const template = @import("template.zig"); @@ -14,12 +12,7 @@ pub const parser = @import("parser.zig"); pub const mixin = @import("mixin.zig"); pub const runtime = @import("runtime.zig"); pub const codegen = @import("codegen.zig"); - -// Build step for compiling templates (only available in build scripts) -pub const compile_tpls = if (builtin.is_test or @import("builtin").output_mode == .Obj) - void -else - @import("compile_tpls.zig"); +pub const compile_tpls = @import("compile_tpls.zig"); // Re-export main types pub const ViewEngine = view_engine.ViewEngine; @@ -34,12 +27,6 @@ pub const CompileError = pug.CompileError; // Convenience function for inline templates with data pub const renderTemplate = template.renderWithData; -// Build step convenience exports (only available in build context) -pub const addCompileStep = if (@TypeOf(compile_tpls) == type and compile_tpls != void) - compile_tpls.addCompileStep -else - void; -pub const CompileTplsOptions = if (@TypeOf(compile_tpls) == type and compile_tpls != void) - compile_tpls.CompileOptions -else - void; +// Build step convenience exports +pub const addCompileStep = compile_tpls.addCompileStep; +pub const CompileTplsOptions = compile_tpls.CompileOptions;