ripplejs / ripple

A tiny foundation for building reactive views
http://ripplejs.github.io
1.28k stars 66 forks source link

Ripple + jade #43

Closed vmariano closed 9 years ago

vmariano commented 9 years ago

I come from a project who use jade as template engine. Is possible combine both jade template with a ripple template?

With jade, I can do:

jadeTemplate({item: item});

For the moment I do something like

var Template = ripple(jadeTemplate());

I need to call it, to get the template as string.

Can I do in other way?

anthonyshort commented 9 years ago

You could compile a jade template to a string or HTML and pass that into ripple as the template to parse, like you're doing.

Do you want to use the view data to render the jade template to a string? If so, you could do something like,

function jade(options) {
  return function(View) {
    View.on('created', function(view){
      view.template = jadeTemplate(view);
    });
  }
}

And then:

var Template = ripple(jadeString)
  .use(jade());

Depends what you're trying to do though

vmariano commented 9 years ago

Thanks for your help!

I'm really new with ripple and i'm in the middle of migration from component/dom to ripple. :)