-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
135 lines (124 loc) · 4.87 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
{
/*
* All build file options are documented here:
* https://github.com/jrburke/r.js/blob/master/build/example.build.js
*/
/*
* The top level directory that contains your app.
* If this option is used then it assumed your scripts are in a
* subdirectory under this path.
*/
appDir: './src',
/*
* By default, all modules are located relative to this path. If baseUrl
* is not explicitly set, then all modules are loaded relative to
* the directory that holds the build file. If appDir is set, then
* baseUrl should be specified as relative to the appDir.
*/
// baseUrl: './src',
/*
* The directory path to save the output. If not specified, then
* the path will default to be a directory called "build" as a sibling
* to the build file.
*/
//dir: './dist',
/*
* If you prefer the "main" JS file configuration
* to be read for the build so that you do not have to duplicate the values
* in a separate configuration, set this property to the location of that
* main / config JS file. The first requirejs({}), require({}),
* requirejs.config({}), or require.config({}) call found in that
* file will be used.
*/
mainConfigFile: 'src/static/js/common.js',
/*
* How to optimize all the JS files in the build output directory.
* Right now only the following values
* are supported:
* - "uglify": (default) uses UglifyJS to minify the code.
* - "uglify2": in version 2.1.2+. Uses UglifyJS2.
* - "none": no minification will be done.
*/
optimize: 'uglify2',
/*
* Uglify2 Options
* For possible values see:
* http://lisperator.net/uglifyjs/codegen
* http://lisperator.net/uglifyjs/compress
*/
uglify2: {
output: {
beautify: false // true outputs more readble minified code
},
compress: {
sequences : true, // join consecutive statemets with the “comma operator”
properties : true, // optimize property access: a["foo"] → a.foo
dead_code : true, // discard unreachable code
drop_debugger : true, // discard “debugger” statements
unsafe : true, // some unsafe optimizations (see below)
conditionals : true, // optimize if-s and conditional expressions
comparisons : true, // optimize comparisons
evaluate : true, // evaluate constant expressions
booleans : true, // optimize boolean expressions
loops : true, // optimize loops
unused : true, // drop unused variables/functions
hoist_funs : true, // hoist function declarations
hoist_vars : false, // hoist variable declarations
if_return : true, // optimize if-s followed by return/continue
join_vars : true, // join var declarations
cascade : true, // try to cascade `right` into `left` in sequences
side_effects : true, // drop side-effect-free statements
warnings : false, // warn about potentially dangerous optimizations/code
global_defs : {} // global definitions
}
},
/*
* CSS Optimizations.
* - standard: @import inlining, comment removal and line returns.
* - standard.keepLines: like "standard" but keeps line returns.
* - standard.keepComments: keeps the file comments, but removes line returns.
* - standard.keepComments.keepLines: keeps the file comments and line returns.
* - none: skip CSS optimizations.
*/
// CSS compression is handled by compass / scss
optimizeCss: 'none',
removeCombined: true,
inlineText: true,
skipDirOptimize: true,
pragmasOnSave: {
//removes Handlebars.Parser code (used to compile template strings) set
//it to `false` if you need to parse template strings even after build
excludeHbsParser : true,
// kills the entire plugin set once it's built.
excludeHbs: true,
// removes i18n precompiler, handlebars and json2
excludeAfterBuild: true
},
/*
* List the modules that will be optimized. All their immediate and deep
* dependencies will be included in the module's file when the build is done.
*/
/*
* List the modules that will be optimized. All their immediate and deep
* dependencies will be included in the module's file when the build is done.
*/
modules: [
{
name: 'common',
include: [
'app/renderer',
'app/vent',
'backbone',
'handlebars',
'hbs',
'jquery',
'marionette',
'underscore'
]
},
{
name: 'main',
exclude: ['common']
}
]
}