forked from contao/contao
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
106 lines (96 loc) · 2.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
'use strict';
var gulp = require('gulp'),
csso = require('gulp-csso'),
ignore = require('gulp-ignore'),
rename = require('gulp-rename'),
svgo = require('gulp-svgo'),
uglify = require('gulp-uglify-es').default,
pump = require('pump');
gulp.task('minify-public', function (cb) {
pump(
[
gulp.src('core-bundle/public/*.js'),
ignore.exclude('*.min.js'),
uglify({
output: {
comments: false
}
}),
rename({
suffix: '.min'
}),
gulp.dest('core-bundle/public')
],
cb
);
});
gulp.task('minify-theme-js', function (cb) {
pump(
[
gulp.src('core-bundle/contao/themes/flexible/*.js'),
ignore.exclude('*.min.js'),
uglify({
output: {
comments: false
}
}),
rename({
suffix: '.min'
}),
gulp.dest('core-bundle/contao/themes/flexible')
],
cb
);
});
gulp.task('minify-theme-css', function (cb) {
pump(
[
gulp.src('core-bundle/contao/themes/flexible/*.css'),
ignore.exclude('*.min.css'),
csso({
comments: false,
restructure: false
}),
rename({
suffix: '.min'
}),
gulp.dest('core-bundle/contao/themes/flexible')
],
cb
);
});
gulp.task('minify-theme-icons', function (cb) {
pump(
[
gulp.src('core-bundle/contao/themes/flexible/icons/*.svg'),
svgo(),
gulp.dest('core-bundle/contao/themes/flexible/icons')
],
cb
);
});
gulp.task('watch', function () {
gulp.watch(
[
'core-bundle/public/*.js',
'!core-bundle/public/*.min.js'
],
gulp.series('minify-public')
);
gulp.watch(
[
'core-bundle/contao/themes/flexible/*.js',
'!core-bundle/contao/themes/flexible/*.min.js'
],
gulp.series('minify-theme-js')
);
gulp.watch(
[
'core-bundle/contao/themes/flexible/*.css',
'!core-bundle/contao/themes/flexible/*.min.css'
],
gulp.series('minify-theme-css')
);
gulp.watch('core-bundle/contao/themes/flexible/icons/*.svg', gulp.series('minify-theme-icons'));
});
gulp.task('default', gulp.parallel('minify-public', 'minify-theme-js', 'minify-theme-css', 'minify-theme-icons'));