Created
April 10, 2013 15:48
-
-
Save stream7/5355821 to your computer and use it in GitHub Desktop.
main.js
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
require.config({ | |
paths: { | |
jquery: '../components/jquery/jquery', | |
backbone: '../components/backbone/backbone', | |
underscore: '../components/underscore/underscore', | |
handlebars: '../components/handlebars/handlebars', | |
cookie: 'vendor/jquery.cookie', | |
routefilter: 'vendor/backbone.routefilter', | |
text: '../components/requirejs-text/text' | |
}, | |
shim: { | |
backbone: { | |
deps: ['jquery', 'underscore'], | |
exports: 'Backbone' | |
}, | |
underscore: { | |
exports: '_' | |
}, | |
handlebars: { | |
exports: 'Handlebars' | |
}, | |
cookie: { | |
deps: ['jquery'] | |
}, | |
routefilter: { | |
deps: ['backbone'] | |
} | |
}, | |
map: { | |
'*': { | |
'css': 'vendor/require-css/css' | |
} | |
} | |
}); | |
require(['jquery', 'app'], function ($, App) { | |
'use strict'; | |
$(function () { | |
App.start(); | |
}); | |
}); |
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
requirejs: { | |
dist: { | |
// Options: https://github.com/jrburke/r.js/blob/master/build/example.build.js | |
options: { | |
// `name` and `out` is set by grunt-usemin | |
baseUrl: 'app/scripts', | |
// optimize: 'none', | |
// TODO: Figure out how to make sourcemaps work with grunt-usemin | |
// https://github.com/yeoman/grunt-usemin/issues/30 | |
//generateSourceMaps: true, | |
// required to support SourceMaps | |
// http://requirejs.org/docs/errors.html#sourcemapcomments | |
preserveLicenseComments: false, | |
useStrict: true, | |
wrap: true | |
//uglify2: {} // https://github.com/mishoo/UglifyJS2 | |
} | |
} | |
}, |
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
define(['backbone', | |
'jquery', | |
'collections/articles', | |
'css!styles/app'], function (Backbone, $, Articles) { | |
var AppView = Backbone.View.extend({ | |
initialize: function (options) { | |
this.router = options.router; | |
this.articles = new Articles(); | |
this.articles.fetch(); | |
}, | |
render: function () { | |
this.$el.html('<p>Hello world</p>'); | |
return this; | |
} | |
}); | |
return AppView; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment