forked from contao/contao
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
105 lines (96 loc) · 2.79 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
'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-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({
multipass: true,
plugins: [{
inlineStyles: {
onlyMatchedOnce: false
}
}]
}),
gulp.dest('core-bundle/contao/themes/flexible/icons')
],
cb
);
});
gulp.task('minify-dark-theme-icons', function (cb) {
pump(
[
gulp.src('core-bundle/contao/themes/flexible/icons-dark/*.svg'),
svgo({
multipass: true,
plugins: [{
inlineStyles: {
onlyMatchedOnce: false
}
}]
}),
gulp.dest('core-bundle/contao/themes/flexible/icons-dark')
],
cb
);
});
gulp.task('watch', function () {
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.watch('core-bundle/contao/themes/flexible/icons-dark/*.svg', gulp.series('minify-dark-theme-icons'));
});
gulp.task('default', gulp.parallel('minify-theme-js', 'minify-theme-css', 'minify-theme-icons', 'minify-dark-theme-icons'));