ShadowFox/gulpfile.js

90 lines
2.6 KiB
JavaScript
Raw Normal View History

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 */
gulp.task('minify_base_code', () => {
2018-02-24 05:36:57 +00:00
return gulp.src(['common-files/*.css', 'userContent-files/*.css', 'userContent-files/*/*.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-26 01:44:08 +00:00
/* Remove internal UUIDs */
gulp.task('remove_UUIDs', function() {
return gulp.src('.')
.pipe(exec('sh remove_UUIDs.sh'))
2018-02-22 05:20:30 +00:00
});
/* userContent file with no addons */
gulp.task('userContent_no_addons', function() {
2018-02-22 05:20:30 +00:00
return gulp.src(['color_variables.css', 'common-files/*.css', 'userContent-files/*.css'])
.pipe(concatCss('userContent_no_addons.css'))
.pipe(gulp.dest('./alternative_user_files'));
2017-12-12 01:43:48 +00:00
});
/* Add everything to userContent */
2018-02-26 01:44:08 +00:00
gulp.task('userContent', ['userContent_no_addons'], function() {
2018-02-22 05:20:30 +00:00
return gulp.src(['color_variables.css', 'common-files/*.css', 'userContent-files/*.css', 'userContent-files/*/*.css'])
2017-12-12 01:43:48 +00:00
.pipe(concatCss('userContent.css'))
.pipe(gulp.dest('.'));
});
2018-02-26 01:44:08 +00:00
/* Create Windows version */
2018-02-04 21:12:19 +00:00
gulp.task('userChrome_windows', function() {
2018-02-22 05:20:30 +00:00
return gulp.src(['color_variables.css', 'common-files/*.css', 'userChrome-files/*.css', 'userChrome-files/windows_fixes/*.css' ])
2018-02-04 21:12:19 +00:00
.pipe(concatCss('userChrome_windows.css'))
.pipe(gulp.dest('./alternative_user_files'));
});
2018-02-22 05:20:30 +00:00
/* Add everything to userChrome */
2018-02-26 01:44:08 +00:00
gulp.task('userChrome', ['userChrome_windows'], function() {
2018-02-22 05:20:30 +00:00
return gulp.src(['color_variables.css', 'common-files/*.css', 'userChrome-files/*.css'])
.pipe(concatCss('userChrome.css'))
.pipe(gulp.dest('.'));
});
2018-02-14 02:57:19 +00:00
2018-02-26 01:44:08 +00:00
/* All */
gulp.task('all', ['userChrome', 'userContent'], function() {
return gulp.src(['userChrome.css', 'userContent.css'])
.pipe(cleanCSS({
2018-02-24 05:36:57 +00:00
level : 1 ,
format: 'beautify'
}))
.pipe(gulp.dest('.'));
});
2018-02-26 01:44:08 +00:00
/* Publish */
gulp.task('publish', ['remove_UUIDs', 'minify_base_code', 'userChrome', 'userContent'], function() {
return gulp.src(['userChrome.css', 'userContent.css', 'alternative_user_files/*.css'])
2018-02-14 02:57:19 +00:00
.pipe(cleanCSS({
2018-02-26 01:44:08 +00:00
level : 2 ,
2018-02-14 02:57:19 +00:00
format: 'beautify'
}))
2018-02-26 01:44:08 +00:00
.pipe(gulp.dest(function(file) {
return file.base;
}));
});
/* userContent file with no addons */
gulp.task('test', function() {
return gulp.src(['color_variables.css', 'common-files/*.css', 'userContent-files/*.css'])
.pipe(exec('sh remove_UUIDs.sh'))
.pipe(concatCss('userContent_no_addons.css'))
.pipe(gulp.dest('./alternative_user_files'));
2018-02-14 02:57:19 +00:00
});