diff --git a/docs/process.d b/docs/process.d index b407aae..bb5b08d 100644 --- a/docs/process.d +++ b/docs/process.d @@ -5,12 +5,14 @@ /// License: MIT License module wgpu.docs.process; -import handlebars.tpl; static import std.file; import std.process; import std.stdio; void main(string[] args) { + import std.array : replace; + import std.string : strip; + string template_ = std.file.readText("views/index.hbs"); struct Constants { @@ -21,7 +23,11 @@ void main(string[] args) { auto gitTagCmd = execute(["git", "describe", "--tags", "--abbrev=0"]); assert(gitTagCmd.status == 0); - gitTagCmd.output.writeln; - auto result = render(template_, Constants(gitTagCmd.output)); - result.writeln; + gitTagCmd.output.write; + + const constants = Constants(gitTagCmd.output.strip); + const result = template_.replace("{{ DUB_VERSION }}", constants.DUB_VERSION); + + if (std.file.exists("docs/index.html")) std.file.remove("docs/index.html"); + std.file.write("docs/index.html", result); } diff --git a/dub.json b/dub.json index e2002fc..f297c8c 100644 --- a/dub.json +++ b/dub.json @@ -32,7 +32,6 @@ }, "dflags": ["-Dddocs"], "postBuildCommands-posix": [ - "dub fetch handlebars", "rdmd -I~/.dub/packages/handlebars/0.3.1/handlebars/source docs/process.d" ] }