This repository has been archived by the owner on Feb 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
128 lines (93 loc) · 3.58 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
var gulp = require('gulp');
var rename = require('gulp-rename');
var vfs = require('vinyl-fs');
/**
* Location where to store the 3rd party libraries
*/
const frontend_folder="./frontend"
const vendor_folder=`${frontend_folder}/vendor`
const frontent_dev_folder_js=`${frontend_folder}/js`
const frontent_dev_folder_css=`${frontend_folder}/css`
/**
* Indication whether the build is done for
* procuction release of for for development release
*/
var status="dev";
/*############################ Bootastraping #################################*/
gulp.task('set_dev',function(done){
status="dev";
done()
});
gulp.task('set_prod',function(done){
status="prod";
done()
});
/*################################### Installing Dependencies ###############################*/
//Move Bootstrap
gulp.task('move_bootstrap',function(done){
var bootstrap_dir='./node_modules/bootstrap/dist';
var dest=`${vendor_folder}/bootstrap`;
var css_files=[`${bootstrap_dir}/css/bootstrap.min.css`,`${bootstrap_dir}/css/bootstrap.min.css.map`];
var js_files=[`${bootstrap_dir}/js/bootstrap.bundle.min.js`,`${bootstrap_dir}/js/bootstrap.bundle.min.js.map`];
gulp.src(css_files).pipe(gulp.dest(`${dest}/css`));
gulp.src(js_files).pipe(gulp.dest(`${dest}/js`));
done();
})
//Jquery & plugins move
gulp.task('move_jquery',function(done){
var jqueryFiles=[
'./node_modules/jquery/dist/jquery.min.js',
'./node_modules/jquery-ui-dist/jquery-ui.min.css',
'./node_modules/jquery-ui-dist/jquery-ui.min.js',
'./node_modules/animatescroll.js/animatescroll.min.js'
];
gulp.src(jqueryFiles).pipe(gulp.dest(vendor_folder));
done();
});
//For fontawesome
gulp.task('move_fontawesome',function(done){
var path='./node_modules/@fortawesome/fontawesome-free';
var dest=vendor_folder+'/font-awesome';
gulp.src(path+'/webfonts/*').pipe(gulp.dest(dest+'/webfonts'));
gulp.src(path+'/css/all.min.css').pipe(gulp.dest(dest+'/css'));
done();
});
gulp.task('move_flagicon_css',function(done){
var path="./node_modules/flag-icon-css";
var dest=vendor_folder+'/flag-icon-css';
gulp.src(`${path}/css/flag-icon.min.css`).pipe(gulp.dest(dest))
gulp.src(`${path}/flags/**`).pipe(gulp.dest(`${dest}/../flags/`))
done();
});
gulp.task('move_jsrender',function(done){
var jsrenderFiles=[
'./node_modules/jsrender/jsrender.min.js',
'./node_modules/jsrender/jsrender.min.js.map'
];
var dest=`${vendor_folder}/jsrender`
gulp.src(jsrenderFiles).pipe(gulp.dest(dest));
done();
})
gulp.task('move_qrious',function(done){
var dest=`${vendor_folder}/qrious`
gulp.src('./node_modules/qrious/dist/qrious.min.*').pipe(gulp.dest(dest));
done();
})
gulp.task('move_cookie_js',function(done){
var dest=`${vendor_folder}/cookie-js`
gulp.src('./node_modules/js-cookie/src/js.cookie.js').pipe(gulp.dest(dest));
done();
});
/******* Build Final Steps ****************************************************/
gulp.task('link_assets',function(done){
vfs.src(frontend_folder+'/*', {followSymlinks: false})
.pipe(vfs.symlink('./web/assets/'));
return done();
});
/* ############################################ Installing Dependencies ##################################### */
gulp.task('move_frontend',
gulp.parallel(['move_bootstrap','move_jquery','move_fontawesome','move_flagicon_css','move_jsrender','move_qrious','move_cookie_js'],
(done)=>{done()}
));
gulp.task('dev',gulp.series(['set_dev','move_frontend','link_assets'],(done)=>{done();}));
gulp.task('default',gulp.series(['dev'],(done)=>{done()}));