-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
74 lines (71 loc) · 2.72 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
* This is the main entry point for requirejs in this application. This file is
* used as the second stop in the require.config chain by the following
* initial require.config calls:
*
* - tasks/requirejs.js, used by grunt-contrib-requirejs for production builds
* - test/index.html used by mocha in the browser and mocha_phantomjs
* - test/main.karma.js used by the karma test runner
* - public/index.html used by you while you develop your app
*
* In all cases, this file is the __second__ link of the requirejs configuration
* chain, which is why it does not have a `baseUrl`. The job of this file
* is to set up paths shared by all consumers of requirejs in this app.
*
* When running tests, test/main.js is the next stop, where more paths are
* defined that are test specific
*
* TODO: iterate on this explanation, explain what require is really doing b/c
* it's use is pretty involved in the generator output and people will really
* appreciate a full example and explanation as given here(I never saw one like
* this while googling at least).
*
*/
/**
* If using karma, change the base path to /base/ which is where karma's built
* in server serves files from. The file must be included in the files karma
* is being told to serve in order for requirejs to pick it up. To include
* and additional file add the file or glob a directory where the file exists
* in the karma configuration files array. Make sure include is set to false.
* We don't want to include the file on the page b/c requirejs will take of that
* and ensure async happens correctly.
*/
var pathPrefix;
if (window.__karma__) {
pathPrefix = '/base/';
} else {
pathPrefix = '../';
}
require.config({
deps: ['main'],
paths: {
'jquery': pathPrefix + 'bower_components/jquery/jquery',
'underscore': pathPrefix + 'bower_components/underscore/underscore',
'handlebars': pathPrefix + 'bower_components/handlebars/handlebars',
'backbone': pathPrefix + 'bower_components/backbone/backbone',
'thorax': pathPrefix + 'bower_components/thorax/thorax',
'coffee-script': pathPrefix + 'bower_components/coffee-script/index',
'cs': pathPrefix + 'bower_components/require-cs/cs',
'text': pathPrefix + 'bower_components/text/text',
'hbs': pathPrefix + 'bower_components/requirejs-hbs/hbs',
'obscura': "../bower_components/backbone.obscura/backbone.obscura"
// not required for production build
// 'templates': pathPrefix + 'tmp/templates'
},
shim: {
'handlebars': {
exports: 'Handlebars'
},
'backbone': {
exports: 'Backbone',
deps: ['jquery', 'underscore']
},
'underscore': {
exports: '_'
},
'thorax': {
exports: 'Thorax',
deps: ['handlebars', 'backbone']
}
}
});