spirit-js / spirit

Modern modular library for building web applications
http://spirit.function.run
ISC License
244 stars 18 forks source link

Feature request: Example using a templating engine #6

Open kokujin opened 7 years ago

hnry commented 7 years ago

There is an example: https://github.com/spirit-js/examples#rendering-templates-with-jade

Is that ok? If it is not clear, let me know why so I can update the example or show more examples?

A template ends up being a string, so you just return the string. And the template libraries have their own compiling function that you can use.

Only complicated part is having caching, but that really depends on what you want the cache to do.

Also other libraries exist for working with different templates https://github.com/tj/consolidate.js Maybe I can show an example using that.

kokujin commented 7 years ago

An example using consolidate would be great since it would cover several templating engines at the same time.