Closed wukerplank closed 6 years ago
@wukerplank I've just added this code to tests and it works as expected. Maybe you have a typo in the template variable name?
let templates = ["helloworld": "<h1>{{ message }}</h1>"]
let context = ["message": "Hello world!"]
let environment = Environment(loader: DictionaryLoader(templates: templates))
let result = try environment.renderTemplate(name: "helloworld", context: context)
try expect(result) == "<h1>Hello world!</h1>"
@ilyapuchka Thanks for getting back to me. Very odd, I've copy/pasted your code with the same result (<h1></h1>
). I'm using Stencil 0.10.1 via cocoapods.
I tried the test code with master and 0.10.1 and it works in both. So, maybe there is something wrong with my project setup. I'll investigate when I have more time.
I'm sorry for this very noobish question: I'm trying to create a minimal example for Stencil, but fail to get the desired output:
This yields:
Instead of:
What do I miss?