-
Notifications
You must be signed in to change notification settings - Fork 58
/
gulpfile.js
102 lines (77 loc) · 2.92 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
'use strict';
var gulp = require('gulp');
var concatCss = require('gulp-concat-css');
var cleanCSS = require('gulp-clean-css');
var exec = require('gulp-exec');
var exec_ch = require('child_process').exec;
/* Minify all base code, edit in place */
gulp.task('minify_base_code', function() {
return gulp.src(['css/common-files/*.css', 'css/userContent-files/*.css', 'css/userContent-files/*/*.css', 'css/userChrome-files/*', 'userChrome-files/*/*.css'])
.pipe(cleanCSS({
level : 2 ,
format: 'beautify'
}))
.pipe(gulp.dest(function(file) {
return file.base;
}));
});
/* Remove internal UUIDs */
gulp.task('remove_UUIDs', function() {
return gulp.src('.')
.pipe(exec('sh scripts/uuids.sh remove nogen'))
});
/* userContent file with no addons */
gulp.task('userContent_no_addons', function() {
return gulp.src(['css/common-files/*.css', 'css/userContent-files/*.css'])
.pipe(concatCss('userContent_no_addons.css'))
.pipe(gulp.dest('./alternative_user_files'));
});
/* Add everything to userContent */
gulp.task('userContent', gulp.parallel('userContent_no_addons', function() {
return gulp.src(['css/common-files/*.css', 'css/userContent-files/*.css', 'css/userContent-files/*/*.css'])
.pipe(concatCss('userContent.css'))
.pipe(gulp.dest('.'));
}));
/* Add everything to userChrome */
gulp.task('userChrome', function() {
return gulp.src(['css/common-files/*.css', 'css/userChrome-files/*.css'])
.pipe(concatCss('userChrome.css'))
.pipe(gulp.dest('.'));
});
/* Minify final user files */
gulp.task('minify_final', function() {
return gulp.src(['userChrome.css', 'userContent.css', 'alternative_user_files/*.css'])
.pipe(cleanCSS({
level : 2 ,
format: 'beautify'
}))
.pipe(gulp.dest(function(file) {
return file.base;
}));
});
/* All */
gulp.task('all', gulp.parallel('userChrome', 'userContent', function() {
return gulp.src(['userChrome.css', 'userContent.css'])
.pipe(cleanCSS({
level : 1 ,
format: 'beautify'
}))
.pipe(gulp.dest('.'));
}));
/* Publish */
gulp.task('publish', gulp.series('minify_base_code', 'userChrome', 'userContent', 'minify_final', 'remove_UUIDs'));
/* Gulp Push - used to push to GitHub and re-add internal UUIDs */
gulp.task('push', function() {
return gulp.src('.')
.pipe(exec('git push'))
.pipe(exec('sh scripts/uuids.sh add nogen'))
});
gulp.task('patch', () => {
return exec_ch('npx ver patch -p css/common-files/color_variables.css userChrome.css userContent.css alternative_user_files/userContent_no_addons.css');
});
gulp.task('minor', () => {
return exec_ch('npx ver minor -p css/common-files/color_variables.css userChrome.css userContent.css alternative_user_files/userContent_no_addons.css');
});
gulp.task('major', () => {
return exec_ch('npx ver major -p css/common-files/color_variables.css userChrome.css userContent.css alternative_user_files/userContent_no_addons.css');
});