-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
152 lines (149 loc) · 4.8 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
({
dir: '_build',
appDir: '.',
baseUrl: 'src',
mainConfigFile: 'src/main.js',
findNestedDependencies: true,
// doesn't handle plugin resources
removeCombined: true,
skipDirOptimize: true,
optimize: 'uglify2',
uglify2: {
output: {
'ascii_only': true
}
},
preserveLicenseComments: false,
// Separate CSS because relative URLs (images) within the CSS do not load
// properly in a production environment.
// https://github.com/guybedford/require-css/issues/139
separateCSS: true,
//optimizeCss: 'none',
inlineText: true,
stubModules: [
'text',
'tpl',
'json'
],
pragmasOnSave: {
excludeRequireCss: true,
excludeTpl: true
},
/**
* An attempt to solve the eternal optimization problem of how to bundle
* components and dependencies together so they will load the fastest for
* the most users, given variables such as
* - the overhead of an HTTP request
* - the browser cache
* - the rate of changes to files
*
* This is a configuration for the optimizer that's meaningless for the
* asynchronous loader, but we put it here because we generate the
* 'bundles' config that is used by the asynchronous loader from it, and
* it's not possible to represent all of this information using bundles.
*
* NOTE bundles.js may need to be updated if modules are changed
*/
modules: [
// begin buildmain.py delimiter
// Build-only dependencies that should be excluded from all built
// modules
{
create: true,
name: 'exclude',
include: [
'css/css',
'css/normalize',
'less/less',
'less/normalize'
]
},
// Global dependencies that may be already loaded on the page. If
// any aren't, then a single file containing them all will be
// requested once.
//
// If bootstrap is already loaded, and you load this bundle,
// you're going to have a bad time.
{
create: true,
name: 'global-deps',
include: [
'jquery',
'jquery.bootstrap',
'underscore'
],
exclude: [
'exclude'
]
},
// Components (and their dependencies) that can be requested
// asynchronously after Vellum has already finished loading, because
// they're not necessary for initial operation.
// // At the moment, this bundle doesn't get used as expected.
// {
// create: true,
// name: 'deferred-components',
// include: [
// // core
// 'codemirror',
// 'diff-match-patch',
// 'CryptoJS',
// 'vellum/expressionEditor',
//
// // uploader
// 'file-uploader',
//
// // form
// 'vellum/writer',
// 'vellum/exporter'
// ],
// exclude: [
// 'exclude',
// 'global-deps',
// // required by things other than the expression editor, ensure
// // that they're not bundled here, otherwise separate bundles
// // is useless
// 'xpath',
// 'vellum/util'
// ]
// },
// Local dependencies that don't change often, except for new ones being
// added.
{
create: true,
name: 'local-deps',
include: [
'jquery.jstree',
'jstree-actions',
'save-button',
'ckeditor',
'ckeditor-jquery',
// shim plugin dependencies don't automatically get included
// NOTE less! and css! cannot be combined in the same module
// https://github.com/guybedford/require-less/issues/48
'css/css!../bower_components/codemirror/lib/codemirror',
'css/css!../bower_components/jstree/dist/themes/default/style',
'css/css!yui-combo',
'css/css!../bower_components/At.js/dist/css/jquery.atwho'
],
exclude: [
'exclude',
'global-deps'
//'deferred-components'
]
},
// Everything else except main.
{
create: true,
name: 'main-components',
include: ['main'],
exclude: [
'exclude',
'global-deps',
//'deferred-components',
'local-deps'
]
}
// end buildmain.py delimiter
]
})