twitter / hogan.js

A compiler for the Mustache templating language
http://twitter.github.io/hogan.js
Apache License 2.0
5.14k stars 431 forks source link

Hogan: lambdas doesn't work with precompiled templates by grunt-hogan, grunt-templates-hogan #225

Closed ssuvorov closed 9 years ago

ssuvorov commented 9 years ago

I create a simple separate project for this issue: https://github.com/ssuvorov/hogan-issue

After compiling template with everything works fine.

Hogan.compile('index.mustache')

But if create a template with grunt (grunt-hogan, grunt-templates-hogan, ...whatever), mustache lambdas doesn't work and I got an error Uncaught TypeError: Cannot read property 'compile' of undefined

ssuvorov commented 9 years ago

The same if I use hulk to precompile

eneko89 commented 9 years ago

The hogan.js readme says:

It's also possible to use HoganTemplate objects without the Hogan compiler present. That means you can pre-compile your templates on the server, and avoid shipping the compiler. However, the optional lambda features from the Mustache spec require the compiler and the original template source to be present.

You can't use lambdas in precompiled templates. The optional lambda feature requires the full hogan compiler and the original template in the browser.

ssuvorov commented 9 years ago

While using precompiled templates you can't use lambdas. Issue could be closed.