Last active
October 8, 2015 15:08
-
-
Save twalker/3349095 to your computer and use it in GitHub Desktop.
sublime snippet for backbone view module with mustache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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