Skip to content

Instantly share code, notes, and snippets.

@twalker
Last active October 8, 2015 15:08
Show Gist options
  • Save twalker/3349095 to your computer and use it in GitHub Desktop.
Save twalker/3349095 to your computer and use it in GitHub Desktop.
sublime snippet for backbone view module with mustache
<snippet>
<content><![CDATA[
/**
* ${1:name} view
*/
define(function(require){
var Backbone = require('backbone'),
Mustache = require('mustache'),
mainTemplate = require('text!views/${1:name}/${1:name}.mustache');
return Backbone.View.extend({
className: '${1:name}',
template: Mustache.compile(mainTemplate),
events: {},
initialize: function(options){
${0}
},
render: function(){
this.\$el.html(this.template(this.model.toJSON()));
return this;
}
});
});
]]></content>
<tabTrigger>bbv</tabTrigger>
<scope>source.js,source.js.embedded.html</scope>
<description>Backbone requirejs view definition</description>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment