forked from schobiwan/EdgeCommons
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
224 lines (194 loc) · 8.22 KB
/
Gruntfile.js
File metadata and controls
224 lines (194 loc) · 8.22 KB
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
// HOW TO RUN THIS SCRIPT:
// - Node.js installed
// - npm install -g grunt-cli
// - npm install -g browserify
// run this script by passing "grunt" to your command line
//================================================
// Configuration
//================================================
var customConfig = {
an: {
version: "1.3.1"
},
rf: {
version: "0.0.4"
}
};
//================================================
//================================================
module.exports = function(grunt) {
// Load plugins
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
//grunt.loadNpmTasks('grunt-replace');
grunt.loadNpmTasks('grunt-text-replace');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json')
});
//================================================================================================
// Custom Tasks
//================================================================================================
//======================================================
// Task "anBuild" - Build Edge Commons for Animate
//======================================================
//
//------------------------------------------------------
function anBuild (fn) {
// Concat
grunt.config.set("concat", {
options: {
separator: ';',
banner: '// EdgeCommons for Edge Animate v'+customConfig.an.version+' +++ Visit edgecommons.org for documentation, updates and examples +++ Copyright (c) 2013 by Simon Widjaja +++ Distributed under the terms of the MIT license (http://www.opensource.org/licenses/mit-license.html) +++ This notice shall be included in all copies or substantial portions of the Software.\n\n'
},
an_allinone: {
src: ['src-Animate/libs/Modulog-0.0.2.js', 'src-Animate/EdgeCommons.js', 'src-Animate/modules/Core/Core.js', 'src-Animate/modules/Parallax/Parallax.js', 'src-Animate/modules/Sound/Sound.js', 'src-Animate/modules/Spotlight/Spotlight.js', 'src-Animate/modules/SVG/SVG.js'],
dest: 'sprint/an/'+customConfig.an.version+'/js/max/EdgeCommons.js'
},
an_core: {
src: ['src-Animate/libs/Modulog-0.0.2.js', 'src-Animate/EdgeCommons.js', 'src-Animate/modules/Core/Core.js'],
dest: 'sprint/an/'+customConfig.an.version+'/js/max/EdgeCommons.Core.js'
},
an_parallax: {
src: ['src-Animate/modules/Parallax/Parallax.js'],
dest: 'sprint/an/'+customConfig.an.version+'/js/max/EdgeCommons.Parallax.js'
},
an_sound: {
src: ['src-Animate/modules/Sound/Sound.js'],
dest: 'sprint/an/'+customConfig.an.version+'/js/max/EdgeCommons.Sound.js'
},
an_spotlight: {
src: ['src-Animate/modules/Spotlight/Spotlight.js'],
dest: 'sprint/an/'+customConfig.an.version+'/js/max/EdgeCommons.Spotlight.js'
},
an_svg: {
src: ['src-Animate/modules/SVG/SVG.js'],
dest: 'sprint/an/'+customConfig.an.version+'/js/max/EdgeCommons.SVG.js'
},
an_explore: {
src: ['src-Animate/modules/Explore/jquery-collision.min.js', 'src-Animate/modules/Explore/Explore.js'],
dest: 'sprint/an/'+customConfig.an.version+'/js/max/EdgeCommons.Explore.js'
},
});
// Replace (grunt-text-replace)
grunt.config.set("replace", {
version: {
src: 'sprint/an/'+customConfig.an.version+'/js/max/*.js',
dest: 'sprint/an/'+customConfig.an.version+'/js/max/',
replacements: [
{from: /EdgeCommons.VERSION = "\d+.\d+.\d+";/, to: 'EdgeCommons.VERSION = "'+customConfig.an.version+'";'}
]
}
});
// Uglify
grunt.config.set("uglify", {
options: {
banner: '// EdgeCommons for Edge Animate v'+customConfig.an.version+' +++ Visit edgecommons.org for documentation, updates and examples +++ Copyright (c) 2013 by Simon Widjaja +++ Distributed under the terms of the MIT license (http://www.opensource.org/licenses/mit-license.html) +++ This notice shall be included in all copies or substantial portions of the Software.\n\n'
},
an_allinone: {
src: 'sprint/an/'+customConfig.an.version+'/js/max/EdgeCommons.js',
dest: 'sprint/an/'+customConfig.an.version+'/js/min/EdgeCommons.js'
},
an_core: {
src: 'sprint/an/'+customConfig.an.version+'/js/max/EdgeCommons.Core.js',
dest: 'sprint/an/'+customConfig.an.version+'/js/min/EdgeCommons.Core.js'
},
an_parallax: {
src: 'sprint/an/'+customConfig.an.version+'/js/max/EdgeCommons.Parallax.js',
dest: 'sprint/an/'+customConfig.an.version+'/js/min/EdgeCommons.Parallax.js'
},
an_sound: {
src: 'sprint/an/'+customConfig.an.version+'/js/max/EdgeCommons.Sound.js',
dest: 'sprint/an/'+customConfig.an.version+'/js/min/EdgeCommons.Sound.js'
},
an_spotlight: {
src: 'sprint/an/'+customConfig.an.version+'/js/max/EdgeCommons.Spotlight.js',
dest: 'sprint/an/'+customConfig.an.version+'/js/min/EdgeCommons.Spotlight.js'
},
an_svg: {
src: 'sprint/an/'+customConfig.an.version+'/js/max/EdgeCommons.SVG.js',
dest: 'sprint/an/'+customConfig.an.version+'/js/min/EdgeCommons.SVG.js'
},
an_explore: {
src: 'sprint/an/'+customConfig.an.version+'/js/max/EdgeCommons.Explore.js',
dest: 'sprint/an/'+customConfig.an.version+'/js/min/EdgeCommons.Explore.js'
}
});
// Copy (CSS)
grunt.config.set("copy", {
main: {
files: [ {expand: true, cwd: 'src-Animate/css/', src: ['**'], dest: 'sprint/an/'+customConfig.an.version+'/css/'} ]
}
});
// Watch
grunt.config.set("watch", {
scripts : {
files: 'src-Animate/**/*.js',
tasks: ['concat', 'replace', 'uglify', 'copy'],
options: {
nospawn: true
}
}
});
// Start Watcher
grunt.task.run("watch");
}
//======================================================
// Task "rfBuild" - Build Edge Commons for Reflow
//======================================================
//
//------------------------------------------------------
function rfBuild (fn) {
// Concat
grunt.config.set("concat", {
options: {
separator: ';'
},
rf: {
src: ['src-Reflow/EdgeCommons.js', 'src-Reflow/modules/Experimental/Experimental.js'],
dest: 'sprint/rf/'+customConfig.rf.version+'/js/max/EdgeCommons.js'
//dest: 'sprint/rf/EdgeCommons.js'
},
});
// Replace (grunt-text-replace)
grunt.config.set("replace", {
version: {
src: 'sprint/rf/'+customConfig.rf.version+'/js/max/EdgeCommons.js',
dest: 'sprint/rf/'+customConfig.rf.version+'/js/max/EdgeCommons.js',
replacements: [
{from: /EdgeCommons.VERSION = "\d+.\d+.\d+";/, to: 'EdgeCommons.VERSION = "'+customConfig.rf.version+'";'}
]
}
});
// Uglify
grunt.config.set("uglify", {
options: {
banner: '// EdgeCommons for Edge Reflow v'+customConfig.rf.version+' +++ Visit edgecommons.org for documentation, updates and examples +++ Copyright (c) 2013 by Simon Widjaja +++ Distributed under the terms of the MIT license (http://www.opensource.org/licenses/mit-license.html) +++ This notice shall be included in all copies or substantial portions of the Software.\n\n'
},
build: {
src: 'sprint/rf/'+customConfig.rf.version+'/js/max/EdgeCommons.js',
dest: 'sprint/rf/'+customConfig.rf.version+'/js/min/EdgeCommons.js'
}
});
// Watch
grunt.config.set("watch", {
scripts : {
files: 'src-Reflow/**/*.js',
tasks: ['concat', 'replace', 'uglify'],
options: {
nospawn: true
}
}
});
// Start Watcher
grunt.task.run("watch");
}
//================================================
// Register Tasks
//================================================
grunt.registerTask('anBuild', "Build Edge Commons for Animate", anBuild);
grunt.registerTask('rfBuild', "Build Edge Commons for Reflow", rfBuild);
grunt.registerTask('default', ['anBuild', 'rfBuild']);
};