2017-12-12 01:43:48 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var gulp = require('gulp');
|
|
|
|
var concatCss = require('gulp-concat-css');
|
2018-02-14 02:57:19 +00:00
|
|
|
var cleanCSS = require('gulp-clean-css');
|
2018-02-26 01:44:08 +00:00
|
|
|
var exec = require('gulp-exec');
|
2018-02-14 02:57:19 +00:00
|
|
|
|
2018-02-26 01:44:08 +00:00
|
|
|
/* Minify all base code, edit in place */
|
2018-02-27 03:16:13 +00:00
|
|
|
gulp.task('minify_base_code', function() {
|
2018-03-11 21:58:02 +00:00
|
|
|
return gulp.src(['css/common-files/*.css', 'css/userContent-files/*.css', 'css/userContent-files/*/*.css', 'css/userChrome-files/*', 'userChrome-files/*/*.css'])
|
2018-02-22 05:20:30 +00:00
|
|
|
.pipe(cleanCSS({
|
|
|
|
level : 2 ,
|
|
|
|
format: 'beautify'
|
|
|
|
}))
|
|
|
|
.pipe(gulp.dest(function(file) {
|
|
|
|
return file.base;
|
|
|
|
}));
|
|
|
|
});
|
|
|
|
|
2018-02-27 03:16:13 +00:00
|
|
|
|
2018-02-26 01:44:08 +00:00
|
|
|
/* Remove internal UUIDs */
|
|
|
|
gulp.task('remove_UUIDs', function() {
|
|
|
|
return gulp.src('.')
|
2018-04-21 23:21:35 +00:00
|
|
|
.pipe(exec('sh scripts/uuids.sh remove'))
|
2018-02-22 05:20:30 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-01-31 21:36:34 +00:00
|
|
|
/* userContent file with no addons */
|
|
|
|
gulp.task('userContent_no_addons', function() {
|
2018-03-11 21:58:02 +00:00
|
|
|
return gulp.src(['css/common-files/*.css', 'css/userContent-files/*.css'])
|
2018-01-31 21:36:34 +00:00
|
|
|
.pipe(concatCss('userContent_no_addons.css'))
|
|
|
|
.pipe(gulp.dest('./alternative_user_files'));
|
2017-12-12 01:43:48 +00:00
|
|
|
});
|
|
|
|
|
2018-01-31 21:36:34 +00:00
|
|
|
|
|
|
|
/* Add everything to userContent */
|
2018-02-27 03:16:13 +00:00
|
|
|
gulp.task('userContent', gulp.parallel('userContent_no_addons', function() {
|
2018-03-11 21:58:02 +00:00
|
|
|
return gulp.src(['css/common-files/*.css', 'css/userContent-files/*.css', 'css/userContent-files/*/*.css'])
|
2017-12-12 01:43:48 +00:00
|
|
|
.pipe(concatCss('userContent.css'))
|
|
|
|
.pipe(gulp.dest('.'));
|
2018-02-27 03:16:13 +00:00
|
|
|
}));
|
2017-12-12 01:43:48 +00:00
|
|
|
|
|
|
|
|
2018-02-22 05:20:30 +00:00
|
|
|
/* Add everything to userChrome */
|
2018-03-16 15:27:48 +00:00
|
|
|
gulp.task('userChrome', function() {
|
2018-03-11 21:58:02 +00:00
|
|
|
return gulp.src(['css/common-files/*.css', 'css/userChrome-files/*.css'])
|
2017-12-12 06:26:47 +00:00
|
|
|
.pipe(concatCss('userChrome.css'))
|
|
|
|
.pipe(gulp.dest('.'));
|
2018-03-16 23:09:23 +00:00
|
|
|
});
|
2018-02-27 03:16:13 +00:00
|
|
|
|
|
|
|
/* 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;
|
|
|
|
}));
|
2017-12-12 06:26:47 +00:00
|
|
|
});
|
2018-02-14 02:57:19 +00:00
|
|
|
|
2018-02-26 01:44:08 +00:00
|
|
|
|
|
|
|
|
2018-02-27 03:16:13 +00:00
|
|
|
|
2018-02-26 01:44:08 +00:00
|
|
|
/* All */
|
2018-02-27 03:16:13 +00:00
|
|
|
gulp.task('all', gulp.parallel('userChrome', 'userContent', function() {
|
2018-02-24 02:55:05 +00:00
|
|
|
return gulp.src(['userChrome.css', 'userContent.css'])
|
|
|
|
.pipe(cleanCSS({
|
2018-02-24 05:36:57 +00:00
|
|
|
level : 1 ,
|
2018-02-24 02:55:05 +00:00
|
|
|
format: 'beautify'
|
|
|
|
}))
|
|
|
|
.pipe(gulp.dest('.'));
|
2018-02-27 03:16:13 +00:00
|
|
|
}));
|
2018-02-24 02:55:05 +00:00
|
|
|
|
2018-02-26 01:44:08 +00:00
|
|
|
/* Publish */
|
2018-04-21 23:21:35 +00:00
|
|
|
gulp.task('publish', gulp.series('minify_base_code', 'userChrome', 'userContent', 'minify_final', 'remove_UUIDs'));
|
2018-02-27 03:16:13 +00:00
|
|
|
|
|
|
|
|
2018-02-26 01:44:08 +00:00
|
|
|
|
2018-02-26 01:59:35 +00:00
|
|
|
/* Gulp Push - used to push to GitHub and re-add internal UUIDs */
|
|
|
|
gulp.task('push', function() {
|
|
|
|
return gulp.src('.')
|
|
|
|
.pipe(exec('git push'))
|
2018-04-21 23:21:35 +00:00
|
|
|
.pipe(exec('sh scripts/uuids.sh add'))
|
2018-02-14 02:57:19 +00:00
|
|
|
});
|