-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
executable file
·127 lines (117 loc) · 2.9 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
/*jshint esversion: 6 */
/**
*
* @author Julian Bogdani <[email protected]>
* @copyright 2007-2021 Julian Bogdani
* @license AGPL-3.0; see LICENSE file
*/
const gulp = require('gulp'),
uglify = require('gulp-uglify'),
less = require('gulp-less'),
cleanCSS = require('gulp-clean-css'),
rename = require("gulp-rename");
const libs = {
'jquery': [
'dist/jquery.min.js',
'dist/jquery.min.map'
],
'bootstrap': [
'dist/css/bootstrap.min.css',
'dist/css/bootstrap.min.css.map',
'dist/js/bootstrap.bundle.min.js',
'dist/js/bootstrap.bundle.min.js.map'
],
'popper.js': [
'dist/popper.min.js',
'dist/popper-utils.min.js'
],
'bootstrap3': [
'dist/css/bootstrap.min.css',
'dist/css/bootstrap.css.map',
'dist/fonts/*',
'dist/js/bootstrap.min.js'
],
'bootstrap-datepicker': [
'dist/css/bootstrap-datepicker3.min.css',
'dist/js/bootstrap-datepicker.min.js',
'dist/locales/*'
],
'datatables.net': [
'js/jquery.dataTables.min.js'
],
'datatables.net-bs': [
'**/*.min.*'
],
'google-code-prettify': [
'bin/*'
],
'jquery-nestable': [
'jquery.nestable.js'
],
'@fancyapps': [
'fancybox/dist/*.min.*'
],
'tinymce': [
"plugins/*/plugin.min.js",
"skins/**/*",
"themes/**/*",
"icons/**/*.min.js",
"tinymce.min*"
],
'fine-uploader': [
"fine-uploader/*.gif",
"fine-uploader/fine-uploader.min.js",
"fine-uploader/fine-uploader.min.css"
],
"font-awesome": [
"fonts/*",
"css/font-awesome.min*"
],
"jquery-mousewheel": [
"jquery.mousewheel.js"
],
"izitoast": [
"dist/js/iziToast.min.js",
"dist/css/iziToast.min.css"
],
"select2": [
"dist/css/select2.min.css",
"dist/js/*min.js",
"dist/js/i18n/*"
],
"select2-bootstrap-theme": [
"dist/*.min.css"
]
};
gulp.task('moveLibs', function(done){
Object.entries(libs).forEach(([key, vals]) => {
vals.forEach( (v) => {
gulp.src(`node_modules/${key}/${v}`, {base: `./node_modules/`})
.pipe(gulp.dest(`./frontLibs/`));
});
});
done();
});
gulp.task('frontCSS', function () {
return gulp.src('sites/default/css/styles.less')
.pipe(less().on('error', function(err){ console.log(err.message); this.emit('end'); }))
.pipe(cleanCSS())
.pipe(gulp.dest('sites/default/css/'));
});
gulp.task('adminCSS', function () {
return gulp.src('less/admin.less')
.pipe(less().on('error', function(err){ console.log(err.message); this.emit('end'); }))
.pipe(cleanCSS())
.pipe(gulp.dest('css/'));
});
gulp.task('adminJS', function(){
return gulp.src('./js/admin.js')
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./js/'));
});
gulp.task('default', function(){
gulp.watch(['./js/admin.js'], gulp.series('adminJS'));
gulp.watch(['less/admin.less'], gulp.series('adminCSS'));
gulp.watch('sites/default/css/*.less', gulp.series('frontCSS'));
});