This solves #87
The template files are loaded once after their existence is validated inside the html-validator. One instance of the template-loader is created in walder.js and passes through.
The template-loader takes an HTMLInfo object and saves its front-matter, it also does this recursively for layouts used by the given template. When the front-matter is needed later, getTemplateFromCache is to be used.
Because both html-converter and the new template-loader require the HTMLInfoof the layout if one exists. I have given HTMLInfo a function that takes a layout file path and returns a new HTMLInfo object for that layout.
Two tests where added.
In the future it might be good to edit HTMLInfo to contain a pointer towards the HTMLInfo of its layout and other front-matter, this way front-matter and HTMLInfo can be one object.
This solves #87 The template files are loaded once after their existence is validated inside the
html-validator
. One instance of the template-loader is created inwalder.js
and passes through. The template-loader takes anHTMLInfo
object and saves its front-matter, it also does this recursively for layouts used by the given template. When the front-matter is needed later,getTemplateFromCache
is to be used.Because both html-converter and the new template-loader require the
HTMLInfo
of the layout if one exists. I have givenHTMLInfo
a function that takes a layout file path and returns a newHTMLInfo
object for that layout.Two tests where added.
In the future it might be good to edit
HTMLInfo
to contain a pointer towards theHTMLInfo
of its layout and otherfront-matter
, this wayfront-matter
andHTMLInfo
can be one object.