TemplateView introduces a few efficiencies for working with views and templates.
npm install marionette.templateview
$ npm install
$ npm start
`Marionette.TemplateView
TemplateView is a development sandbox which offers template designers more
control over user experience outside of the core codebase. It is built around
the use of inline templates as a means of contextual and efficient prototyping.
In terms of working with Backbone/Marionette this extension is essentially
ItemView and CollectionView merged together with added functionality to drive
design workflow via inline templates.
Example
##### Input
`
TempalteView
var Model = Backbone.Model.extend();
var Collection = Backbone.Collection.extend({
model: Model
});
var collection = new Collection([
{title: 'test1', desc:"This is the first item."},
{title: 'test2', desc:"This is the second item."}
]);
var ChildSubView = Marionette.TemplateView.extend({
template: "#childSubViewTemplate"
});
var ChildView = Marionette.TemplateView.extend({
template: "#childViewTemplate",
subViews: [ChildSubView]
});
var CollectionSubView = Marionette.TemplateView.extend({
template: "#collectionSubViewTemplate"
});
var CollectionView = Marionette.TemplateView.extend({
collection: collection,
childView: ChildView,
subViews: [CollectionSubView],
template: "#collectionViewTemplate"
});
var collectionView = new CollectionView();
collectionView.render();
`
##### Output
`
TempalteView
...
Item: test1
This is the first item.
Item: test2
This is the second item.
Count: 2
``