This repository has been archived by the owner on Feb 12, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.js
56 lines (51 loc) · 1.93 KB
/
build.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
{
// These configure to recreate the structure in
// "app/assets/javascripts/**/*" to "public/javascripts-built/**/*"
baseUrl: '.',
appDir: '../app/assets/javascripts',
dir: '../public/javascripts-built',
// Prevent the Optimizer from inlining / minifying third-party libraries.
// They are to be fetched from a CDN, or are already minified.
paths: {
backbone: 'empty:',
jquery: 'empty:',
require: 'empty:',
underscore: 'empty:'
},
modules: [
//First set up the common build layer.
{
//module names are relative to baseUrl
name: 'common',
//List common dependencies here. Only need to list
//top level dependencies, "include" will find
//nested dependencies.
include: ['jquery',
'app/lib',
'app/controller/Base',
'app/model/Base'
]
},
//Now set up a build layer for each main layer, but exclude
//the common one. "exclude" will exclude nested
//the nested, built dependencies from "common". Any
//"exclude" that includes built modules should be
//listed before the build layer that wants to exclude it.
//The "page1" and "page2" modules are **not** the targets of
//the optimization, because shim config is in play, and
//shimmed dependencies need to maintain their load order.
//In this example, common.js will hold jquery, so backbone
//needs to be delayed from loading until common.js finishes.
//That loading sequence is controlled in page1.js.
{
//module names are relative to baseUrl/paths config
name: 'app/main1',
exclude: ['common']
},
{
//module names are relative to baseUrl
name: 'app/main2',
exclude: ['common']
}
]
}