@luanews

Powered by Jekyll

Cosmo Tricks

Cosmo is a very flexible template engine, and it has evolved quite a lot since the version that shipped along with the first releases of Sputnik. The documentation has grown accordingly, but the newer features that add more expressive power to Cosmo end up buried among the earlier ones, so at first glance Cosmo may not seem as expressive as template engines in other languages. For example, the first version of Cosmo only allowed iteration via special generator functions that called cosmo.yield for each item they wanted to produce. This lead to code such as:

blog comments powered by Disqus