This repository was archived by the owner on Dec 19, 2024. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathgulpfile.js
More file actions
123 lines (117 loc) · 4.48 KB
/
Copy pathgulpfile.js
File metadata and controls
123 lines (117 loc) · 4.48 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
/*
* @package ShadosSocks Manager
* @link https://github.com/localzet/shadowsocks-manager-js
* @link https://github.com/shadowsocks/shadowsocks-manager
*
* @author Ivan Zorin <creator@localzet.com>
* @copyright Copyright (c) 2018-2024 Zorin Projects S.P.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* For any questions, please contact <creator@localzet.com>
*/
const del = require('del');
const gulp = require('gulp');
const path = require('path');
const webpackStream = require('webpack-stream');
const concat = require('gulp-concat');
const cleanCSS = require('gulp-clean-css');
gulp.task('clean', () => {
return del([
'plugins/webgui/libs/bundle.js',
'plugins/webgui/libs/lib.js',
'plugins/webgui/libs/style.css',
]);
});
gulp.task('webguiLib', () => {
return gulp.src([
'plugins/webgui/libs/jquery.min.js',
'plugins/webgui/libs/angular.min.js',
'plugins/webgui/libs/angular-inview.js',
'plugins/webgui/libs/angular-animate.min.js',
'plugins/webgui/libs/angular-aria.min.js',
'plugins/webgui/libs/angular-messages.min.js',
'plugins/webgui/libs/angular-material.min.js',
'plugins/webgui/libs/angular-ui-router.min.js',
'plugins/webgui/libs/angular-translate.min.js',
'plugins/webgui/libs/qrcode.min.js',
'plugins/webgui/libs/angular-qr.min.js',
'plugins/webgui/libs/clipboard.min.js',
'plugins/webgui/libs/ngclipboard.min.js',
'plugins/webgui/libs/ngStorage.min.js',
'plugins/webgui/libs/Chart.min.js',
'plugins/webgui/libs/angular-chart.min.js',
'plugins/webgui/libs/moment.min.js',
'plugins/webgui/libs/angular-moment.min.js',
'plugins/webgui/libs/angular-websocket.min.js',
'plugins/webgui/libs/marked.min.js',
'plugins/webgui/libs/angular-marked.min.js',
])
.pipe(concat('lib.js'))
.pipe(gulp.dest('plugins/webgui/libs'));
});
gulp.task('webguiBuild', () => {
return gulp.src([
'plugins/webgui/public/**/*.js',
])
.pipe(webpackStream({
entry: './plugins/webgui/public/app.js',
output: {
path: path.resolve(__dirname, 'libs'),
filename: 'bundle.js'
},
externals: [
{
window: 'window'
}
],
module: {
rules: [{
test: /\.js$/,
use: [{
loader: 'babel-loader',
options: {
presets: [
[
'@babel/env', {
targets: {
browsers: [
'last 3 versions'
]
}
}
]
]
}
}]
}]
},
optimization: {
minimize: true,
},
mode: 'production',
performance: {hints: false},
}))
.pipe(gulp.dest('plugins/webgui/libs'));
});
gulp.task('webguiCss', () => {
return gulp.src([
'plugins/webgui/public/styles/**/*.css',
])
.pipe(cleanCSS({compatibility: '*'}))
.pipe(concat('style.css'))
.pipe(gulp.dest('plugins/webgui/libs'));
});
gulp.task('default', gulp.series('clean', gulp.parallel('webguiBuild', 'webguiLib', 'webguiCss')));