question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using Mustache as template engine (now that it does not have a compile method)

See original GitHub issue

The examples given in #331 no longer work because mustache has removed compile method. (Refer: https://github.com/janl/mustache.js/issues/346)

The browser now reports:

Uncaught TypeError: Object ... has no method 'compile' 

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
kzapcommented, Aug 17, 2014

templates.suggestion now takes a function (context) { return result; } use the ff for mustache or other template engines:

templates: {
    empty: [
      '<div class="empty-message">',
      'unable to find any affiliate or member',
      '</div>'
    ].join('\n'),
    suggestion: function (context) {
        return Mustache.render('<p><strong>{{username}}</strong> – &lt;{{email_address}}&gt;</p>', context);
    }
}
0reactions
antonioaltamuracommented, Dec 6, 2015

very thanks @kzap

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introduction to Mustache - Baeldung
Learn how to use Mustache, a logicless template engine for creating dynamic HTML pages, configuration files, etc.
Read more >
The Ultimate Mustache Tutorial - tsmean
You're not ready yet. The idea is, that you write templates that adhere to the Mustache specification, that then can be compiled /...
Read more >
Using Templates - OpenAPI Generator
Adding/modifying template logic simply requires a little bit of mustache, for which you can use existing templates as a guide. #Custom Engines.
Read more >
Precompile mustache templates or load externally?
About the Mustache in general - you cannot compile it strictly speaking. Templates get interpreted each time you "instantiate" the template.
Read more >
How To Render Markup With JavaScript Mustache Template
There are many ways to merge data with templates to render markup. Mustache is a simple, agnostic templating library implementing in many ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found