Add template library loading from FileSystem

This commit is contained in:
Adam Fowler
2021-03-12 11:04:17 +00:00
parent 6be7a382fb
commit 902c300969
5 changed files with 101 additions and 50 deletions

View File

@@ -1,9 +1,14 @@
public class HBMustacheLibrary {
init() {
public init() {
self.templates = [:]
}
public init(directory: String) {
self.templates = [:]
self.loadTemplates(from: directory)
}
public func register(_ template: HBMustacheTemplate, named name: String) {
templates[name] = template
}