├── README.md ├── Snippets ├── Collection.tmSnippet ├── ItemView.tmSnippet ├── Model.tmSnippet ├── View.tmSnippet ├── _get.tmSnippet ├── _set.tmSnippet └── el_append.tmSnippet ├── Syntaxes └── JavaScript (Backbone).tmLanguage └── info.plist /README.md: -------------------------------------------------------------------------------- 1 | # TextMate bundle for Backbone.js 2 | 3 | ## Installation 4 | 5 | To install via Git: 6 | 7 | mkdir -p ~/Library/Application\ Support/TextMate/Bundles 8 | cd ~/Library/Application\ Support/TextMate/Bundles 9 | git clone git://github.com/drnic/Backbone.tmbundle.git 10 | osascript -e 'tell app "TextMate" to reload bundles' 11 | 12 | Source can be viewed or forked via GitHub: [http://github.com/drnic/Backbone.tmbundle](http://github.com/drnic/Backbone.tmbundle) 13 | 14 | ## License 15 | 16 | (The MIT License) 17 | 18 | Copyright (c) 2011 Dr Nic Williams, drnicwilliams@gmail.com 19 | 20 | Permission is hereby granted, free of charge, to any person obtaining 21 | a copy of this software and associated documentation files (the 22 | 'Software'), to deal in the Software without restriction, including 23 | without limitation the rights to use, copy, modify, merge, publish, 24 | distribute, sublicense, and/or sell copies of the Software, and to 25 | permit persons to whom the Software is furnished to do so, subject to 26 | the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be 29 | included in all copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 32 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 33 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 34 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 35 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 36 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 37 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 38 | -------------------------------------------------------------------------------- /Snippets/Collection.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | var ${1:List} = Backbone.Collection.extend({ 7 | model: ${2:Item} 8 | }); 9 | 10 | name 11 | Collection 12 | scope 13 | source.js.backbone 14 | tabTrigger 15 | coll 16 | uuid 17 | F450B649-1EAD-460D-95EA-2CCA4EBD911B 18 | 19 | 20 | -------------------------------------------------------------------------------- /Snippets/ItemView.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | var ${1:${2:Item}View} = Backbone.View.extend({ 7 | tagName: ${5:'${6:li}'}, 8 | 9 | events: { 10 | // 'click button#add': 'callback' 11 | }, 12 | 13 | initialize: function(){ 14 | _.bindAll(this, 'render'); 15 | }, 16 | 17 | render: function(){ 18 | \$(this.el); 19 | return this; 20 | } 21 | }); 22 | 23 | name 24 | ItemView 25 | scope 26 | source.js.backbone 27 | tabTrigger 28 | viewi 29 | uuid 30 | 18B5F867-B3C8-41C2-B190-E9501B4578BE 31 | 32 | 33 | -------------------------------------------------------------------------------- /Snippets/Model.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | var ${1:Item} = Backbone.Model.extend({ 7 | defaults: { 8 | $0 9 | } 10 | }); 11 | 12 | name 13 | Model 14 | scope 15 | source.js.backbone 16 | tabTrigger 17 | model 18 | uuid 19 | D101A204-6EB9-4FD2-8264-CD105FB342C7 20 | 21 | 22 | -------------------------------------------------------------------------------- /Snippets/View.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | var ${1:${2:Item}View} = Backbone.View.extend({ 7 | // attaches `this.el` to an existing element. 8 | el: \$(${5:'${6:body}'}), 9 | 10 | events: { 11 | // 'click button#add': 'callback' 12 | }, 13 | 14 | initialize: function(){ 15 | _.bindAll(this, 'render'); 16 | this.render(); // not all views are self-rendering. This one is. 17 | }, 18 | 19 | render: function(){ 20 | $(this.el).append(${10:"${11:<ul> <li>hello world</li> </ul>}"}); 21 | } 22 | }); 23 | 24 | name 25 | View 26 | scope 27 | source.js.backbone 28 | tabTrigger 29 | view 30 | uuid 31 | EC3DD3F4-7588-483F-84C0-660E044946DD 32 | 33 | 34 | -------------------------------------------------------------------------------- /Snippets/_get.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | .get(${1:'${2:property}'}) 7 | name 8 | .get 9 | scope 10 | source.js.backbone 11 | tabTrigger 12 | .get 13 | uuid 14 | 8D20801A-DCF4-4C78-9F81-CEA4D1ECE1A0 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/_set.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | .set({ 7 | $0 8 | }) 9 | 10 | name 11 | .set 12 | scope 13 | source.js.backbone 14 | tabTrigger 15 | .set 16 | uuid 17 | 97380A80-2796-43DE-BC48-729076B4A205 18 | 19 | 20 | -------------------------------------------------------------------------------- /Snippets/el_append.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | \$(${1:'${2:target}', }this.el).append("$0"); 7 | name 8 | el.append 9 | scope 10 | source.js.backbone 11 | tabTrigger 12 | app 13 | uuid 14 | 69B821B8-C39C-4F54-AC9F-696FF39ABC9F 15 | 16 | 17 | -------------------------------------------------------------------------------- /Syntaxes/JavaScript (Backbone).tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | foldingStartMarker 6 | (^.*\{[^}]*$|^.*\([^\)]*$|^.*/\*(?!.*\*/).*$) 7 | foldingStopMarker 8 | (^\s*\}|^\s*\)|^(?!.*/\*).*\*/) 9 | keyEquivalent 10 | ^~J 11 | name 12 | JavaScript (Backbone) 13 | patterns 14 | 15 | 16 | match 17 | \bBackbone\.(?:Collection|Model|View)\b 18 | name 19 | support.class.backbone 20 | 21 | 22 | match 23 | \b(?:extend)\b 24 | name 25 | support.function.backbone 26 | 27 | 28 | include 29 | source.js 30 | 31 | 32 | include 33 | source.js.jquery 34 | 35 | 36 | include 37 | #leading-space 38 | 39 | 40 | scopeName 41 | source.js.backbone 42 | uuid 43 | 4514D797-AC75-4515-A9D6-EECCEB0E3278 44 | 45 | 46 | -------------------------------------------------------------------------------- /info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Backbone 7 | ordering 8 | 9 | 4514D797-AC75-4515-A9D6-EECCEB0E3278 10 | EC3DD3F4-7588-483F-84C0-660E044946DD 11 | 18B5F867-B3C8-41C2-B190-E9501B4578BE 12 | F450B649-1EAD-460D-95EA-2CCA4EBD911B 13 | D101A204-6EB9-4FD2-8264-CD105FB342C7 14 | 8D20801A-DCF4-4C78-9F81-CEA4D1ECE1A0 15 | 97380A80-2796-43DE-BC48-729076B4A205 16 | 69B821B8-C39C-4F54-AC9F-696FF39ABC9F 17 | 18 | uuid 19 | 80210406-4824-4A1B-A373-18782A770B75 20 | 21 | 22 | --------------------------------------------------------------------------------