javascript - Compiling Emblem.js Without Ember -


i'm trying emblem.js right now. it's wrapper of handlebars write templates. however, docs bit ember.js , handlebars.js dependent. want use emblem.js without ember, there no real explanation on how compile template.

so can use emblem.js without ember (or better, without handlebars dependency)? way i'm doing right now, have function render template:

function render(target, tmpl, data) {     var source   = tmpl.html();     var template = emblem.compile(handlebars, source);     var result = template(data);      target.html(result); } 

is correct way compile emblem? works, have gut feeling there's better way that. in handlebars, compile line quite similar:

var template = handlebars.compile(source); 

thanks answers.

you're doing correctly.

emblem compiles down handlebars runtime, , therefore needs specify handlebars variant you'd compile to. in case, because don't want ember functionality, you'll want

emblem.compile(handlebars, source); 

if wanted ember support, you'd need use ember.handlebars variant

emblem.compile(ember.handlebars, source); 

i'll make sure add stuff docs.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -