1
내 프로젝트에 스텐실이 임베드되었습니다 (Kitura https://github.com/IBM-Swift/Kitura, 템플릿 엔진 스텐실 https://github.com/kylef/Stencil#include). 태그 {% include "comment.html" %}
을 사용하는 방법을 모르겠습니다. 예제가 있지만 작동하지 않습니다.태그 {% include example.html %} 사용 방법
example.stencil.html
<html>
<head>
hello example
{% include "include.stencil.html" %}
</head>
</html>
include.stencil.html
<b>I'm here</b>
코드 스위프트
import Stencil
let pathTemp=Path("include.stencil.html")
let context = Context(dictionary: ["loader": TemplateLoader(paths: [pathTemp])])
do {
let template = try Template(named: fileName)
let rendered = try template.render(context)
return rendered
}catch
{
return "Error:\(error)"
}
Error :Error:'include.stencil.html' template not found in ../include.stencil.html
를 사용하는 방법, PLZ 도와주세요. :)