Closed victorwpbastos closed 9 years ago
require('template.tpl')
returns an object {template: "..."}
already, so you are doing more than you need to. As you could see from the examples on the readme, you can just do Ractive.extend(require('template.tpl'))
.
In my case I want to use Ractive as if it was a Backbone.View:
var SomeView = Ractive.extend({
template: require('templates/someTemplate.tpl'),
onconfig: function() {},
data: {},
someMethod: function() {}
});
that's why I need only to precompile the templates.
var SomeView = Ractive.extend({
template: require('templates/someTemplate.tpl').template,
onconfig: function() {},
data: {},
someMethod: function() {}
});
should work.
How to only precompile templates? I'm using like this:
but it's not working. In console I get
template mismatch
errors!