-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
347 lines (315 loc) · 17.1 KB
/
gulpfile.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
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
var gulp = require('gulp');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');
var stripDebug = require('gulp-strip-debug');
var cssNano = require('gulp-cssnano');
var watchify = require('watchify');
//var browserSync = require('browser-sync').create();
var objConfig = {
scriptsBasePath: "./devScripts/",
scriptDestinationFolder: "./public/js",
watchPath: ['./devScripts/*.js', './devScripts/**/*.js'],
cssPath: './css/',
cssDest: './public/css',
cssBuildName: 'bundle.css'
};
var filesList = [
{build:true, files: [
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"login.js"
], buildName: "login.all.js"},
{build:true, files: [
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"vendor/bootstrap.min.js",
objConfig.scriptsBasePath +"bootstrapValidator.min.js",
objConfig.scriptsBasePath +"validator.js",
objConfig.scriptsBasePath + "doctor/registration.js"
], buildName: "doctor.registration.js"},
{build:true, files: [
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"doctor/doctorDashboard.js",
objConfig.scriptsBasePath +"bootstrapValidator.min.js",
objConfig.scriptsBasePath +"vendor/bootstrap3-typeahead.min.js",
objConfig.scriptsBasePath +"vendor/jquery.ui.widget.js",
objConfig.scriptsBasePath +"vendor/jquery.iframe-transport.js",
objConfig.scriptsBasePath +"vendor/jquery.fileupload.js",
objConfig.scriptsBasePath +"vendor/loadash.js",
objConfig.scriptsBasePath +"vendor/moment.js",
objConfig.scriptsBasePath +"bootstrap-datetimepicker.min.js",
objConfig.scriptsBasePath +"doctor/dash.home.js",
objConfig.scriptsBasePath +"appointment/new.appointment.func.js",
objConfig.scriptsBasePath +"appointment/cancel.appointment.func.js",
objConfig.scriptsBasePath +"appointment/close.appointment.func.js",
objConfig.scriptsBasePath +"appointment/reschedule.appointment.func.js",
objConfig.scriptsBasePath +"appointment/close.appointment.js"
], buildName: "dash.home.js"},
{build:true, files: [
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"validator.js",
objConfig.scriptsBasePath +"bootstrapValidator.min.js",
objConfig.scriptsBasePath +"doctor/doctorDashboard.js",
objConfig.scriptsBasePath +"doctor/profile.edit.js"
], buildName: "doctor.profile.js"},
{build:true, files: [
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"moment.js",
objConfig.scriptsBasePath +"bootstrapValidator.min.js",
objConfig.scriptsBasePath +"vendor/typeahead.bundle.min.js",
objConfig.scriptsBasePath +"vendor/bootstrap3-typeahead.min.js",
objConfig.scriptsBasePath +"bootstrap-datetimepicker.min.js",
objConfig.scriptsBasePath +"doctor/doctorDashboard.js",
objConfig.scriptsBasePath +"appointment/new.appointment.func.js",
objConfig.scriptsBasePath +"appointment/new.appointment.js"
], buildName: "new.appointment.js"},
{build:true, files: [
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"doctor/doctorDashboard.js",
objConfig.scriptsBasePath +"appointment/close.appointment.js"
], buildName: "close.appointment.js"},
{build:true, files: [
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"moment.js",
objConfig.scriptsBasePath +"doctor/doctorDashboard.js",
objConfig.scriptsBasePath +"schedule/manageClinicSchedule.js"
], buildName: "schedule.manageClinicSchedule.js"},
{build:true, files: [
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"doctor/doctorDashboard.js",
objConfig.scriptsBasePath +"vendor/jquery.dataTables.min.js",
objConfig.scriptsBasePath +"vendor/dataTables.bootstrap.js",
objConfig.scriptsBasePath +"appointment/list.appointment.js"
], buildName: "list.appointment.js"},
{build:true, files: [
objConfig.scriptsBasePath +"moment.js",
objConfig.scriptsBasePath +"bootstrapValidator.min.js",
objConfig.scriptsBasePath +"bootstrap-datetimepicker.min.js",
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"doctor/doctorDashboard.js",
objConfig.scriptsBasePath +"schedule/new.schedule.js"
], buildName: "new.schedule.js"},
{build:true, files: [
objConfig.scriptsBasePath +"moment.js",
objConfig.scriptsBasePath +"bootstrapValidator.min.js",
objConfig.scriptsBasePath +"bootstrap-datetimepicker.min.js",
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"doctor/doctorDashboard.js",
objConfig.scriptsBasePath +"schedule/deactivate.schedule.js"
], buildName: "deactivate.schedule.js"},
{build:true, files: [
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"doctor/doctorDashboard.js",
objConfig.scriptsBasePath +"schedule/list.schedule.js"
], buildName: "list.schedule.js"},
{build:true, files: [
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"doctor/doctorDashboard.js",
objConfig.scriptsBasePath +"vendor/jquery.dataTables.min.js",
objConfig.scriptsBasePath +"vendor/dataTables.bootstrap.js",
objConfig.scriptsBasePath +"patient/list.patient.js"
], buildName: "list.patient.js"},
{build:true, files: [
objConfig.scriptsBasePath +"validator.js",
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"doctor/doctorDashboard.js",
objConfig.scriptsBasePath +"bootstrapValidator.min.js",
objConfig.scriptsBasePath +"staff/add.staff.js"
], buildName: "add.staff.js"},
{build:true, files: [
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"doctor/doctorDashboard.js",
objConfig.scriptsBasePath +"staff/list.staff.js"
], buildName: "list.staff.js"},
{build:true, files: [
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"moment.js",
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"doctor/doctorDashboard.js",
objConfig.scriptsBasePath +"vendor/jquery.dataTables.min.js",
objConfig.scriptsBasePath +"vendor/dataTables.bootstrap.js",
objConfig.scriptsBasePath +"patient/patient.history.js"
], buildName: "patient.history.js"},
{build:true, files: [
objConfig.scriptsBasePath +"moment.js",
objConfig.scriptsBasePath +"bootstrap-datetimepicker.min.js",
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"doctor/doctorDashboard.js",
objConfig.scriptsBasePath +"vendor/jquery.ui.widget.js",
objConfig.scriptsBasePath +"vendor/jquery.iframe-transport.js",
objConfig.scriptsBasePath +"vendor/jquery.fileupload.js",
objConfig.scriptsBasePath +"bootstrapValidator.min.js",
objConfig.scriptsBasePath +"patient/patient.entry.js",
objConfig.scriptsBasePath +"vendor/jquery.dataTables.min.js",
objConfig.scriptsBasePath +"vendor/dataTables.bootstrap.js",
objConfig.scriptsBasePath +"patient/patient.history.js"
], buildName: "patient.entry.js"},
{build:true, files: [
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"doctor/doctorDashboard.js",
objConfig.scriptsBasePath +"programme/programme.listing.js"
], buildName: "programme.listing.js"},
{build:true, files: [
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"validator.js",
objConfig.scriptsBasePath + "doctor/doctorDashboard.js",
objConfig.scriptsBasePath + "programme/medical.programme.js"
], buildName: "medical.programme.js"},
{build:true, files: [
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath + "admin/adminDashboard.js",
objConfig.scriptsBasePath + "admin/admin.dash.home.js"
], buildName: "admin.dash.home.js"},
{build:true, files: [
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath + "admin/adminDashboard.js",
objConfig.scriptsBasePath +"vendor/jquery.dataTables.min.js",
objConfig.scriptsBasePath +"vendor/dataTables.bootstrap.js",
objConfig.scriptsBasePath + "admin/admin.doctor.listings.js"
], buildName: "admin.doctor.listings.js"},
{build:true, files: [
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"validator.js",
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"bootstrapValidator.min.js",
objConfig.scriptsBasePath + "admin/adminDashboard.js",
objConfig.scriptsBasePath + "admin/admin.doctor.edit.js"
], buildName: "admin.doctor.edit.js"},
{build:true, files: [
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"validator.js",
objConfig.scriptsBasePath + "doctor/doctorDashboard.js",
objConfig.scriptsBasePath + "doctor/manage.locations.js"
], buildName: "manage.locations.js"},
{build:true, files: [
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath +"vendor/typeahead.bundle.min.js",
objConfig.scriptsBasePath +"vendor/bootstrap3-typeahead.min.js",
objConfig.scriptsBasePath +"bootstrapValidator.min.js",
objConfig.scriptsBasePath + "doctor/doctorDashboard.js",
objConfig.scriptsBasePath +"vendor/jquery.dataTables.min.js",
objConfig.scriptsBasePath +"vendor/dataTables.bootstrap.js",
objConfig.scriptsBasePath + "inventory/addsub.inventory.js"
], buildName: "addsub.inventory.js"},
{build:true, files: [
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath + "doctor/doctorDashboard.js",
objConfig.scriptsBasePath + "doctor/medicineSearch.js"
], buildName: "medicineSearch.js"},
{build:true, files: [
objConfig.scriptsBasePath +"links.js",
objConfig.scriptsBasePath + "doctor/doctorDashboard.js",
objConfig.scriptsBasePath + "vendor/raphael.min.js",
objConfig.scriptsBasePath + "vendor/morris.min.js",
objConfig.scriptsBasePath + "vendor/morris-data.js",
objConfig.scriptsBasePath + "doctor/analytics.js"
], buildName: "analytics.js"},
{build:true, files: [
objConfig.scriptsBasePath + "links.js",
objConfig.scriptsBasePath + "moment.js",
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath + "bootstrap-datetimepicker.min.js",
objConfig.scriptsBasePath + "doctor/doctorDashboard.js",
objConfig.scriptsBasePath + "schedule/schedule.calendar.js"
], buildName: "schedule.calendar.js"},
{build:true, files: [
objConfig.scriptsBasePath + "links.js",
objConfig.scriptsBasePath + "authenticate/forgot.password.js"
], buildName: "forgot.password.js"},
{build:true, files: [
objConfig.scriptsBasePath +"utility.js",
objConfig.scriptsBasePath + "links.js",
objConfig.scriptsBasePath + "authenticate/password.reset.js"
], buildName: "password.reset.js"}
]; //
gulp.task('build-scripts', function(){
//console.log('multi task', JSON.stringify(filesList));
for(var i = 0; i < filesList.length; i++){
//console.log(JSON.stringify(filesList[i]));
if(filesList[i].build == true){
gulp.src(filesList[i].files)
.pipe(sourcemaps.init())
.pipe(concat(filesList[i].buildName))
.pipe(sourcemaps.write())
.pipe(gulp.dest(objConfig.scriptDestinationFolder));
}
}
return;
});
gulp.task('watch-scripts', function() {
gulp.watch(objConfig.watchPath, ['build-scripts']);
});
gulp.task('publish-build-js', function(){
for(var i = 0; i < filesList.length; i++){
//console.log(JSON.stringify(filesList[i]));
console.log('at ' + i + 'name' + filesList[i].buildName);
//console.log('lenght' + filesList.length);
//console.log('error at ' + JSON.stringify(filesList[16]));
//var i = 15;
//error at 17, 26
if(i != 17 && i != 25 && filesList[i].build == true){
gulp.src(filesList[i].files)
.pipe(concat(filesList[i].buildName))
.pipe(uglify())
.pipe(stripDebug())
.pipe(gulp.dest(objConfig.scriptDestinationFolder));
}
}
return;
});
gulp.task('vendor-build-js', function(){
//combining the jquery files first
var vendorFiles = [objConfig.scriptsBasePath + 'vendor/jquery-2.1.4.min.js', objConfig.scriptsBasePath + 'vendor/bootstrap.min.js'];
var fileName = 'jquery.bundle.js';
gulp.src(vendorFiles)
//.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(concat(fileName))
//.pipe(sourcemaps.write())
.pipe(gulp.dest(objConfig.scriptDestinationFolder));
return;
});
var cssBundleFileList = [
objConfig.cssPath + 'styles.css',
objConfig.cssPath + 'my-custom-style.css',
objConfig.cssPath + 'bootstrap.css',
objConfig.cssPath + 'bootstrap-theme.css',
objConfig.cssPath + 'metisMenu.min.css',
objConfig.cssPath + 'sb-admin.css',
objConfig.cssPath + 'font-awesome.min.css'
];
gulp.task('concat-css-dev', function(){
return gulp.src(cssBundleFileList)
.pipe(sourcemaps.init())
.pipe(concat(objConfig.cssBuildName))
.pipe(sourcemaps.write())
//.pipe(cssNano())
.pipe(gulp.dest(objConfig.cssDest));
});
gulp.task('concat-css-publish', function(){
return gulp.src(cssBundleFileList)
//.pipe(sourcemaps.init())
.pipe(concat(objConfig.cssBuildName))
//.pipe(sourcemaps.write())
//.pipe(cssNano())
.pipe(gulp.dest(objConfig.cssDest));
});