BetterDiscordApp-rauenzi/gulpfile.js

30 lines
784 B
JavaScript
Raw Normal View History

2019-05-28 20:19:48 +02:00
const gulp = require("gulp");
2020-07-23 22:51:58 +02:00
const postcss = require("gulp-postcss");
2019-05-28 20:19:48 +02:00
const rename = require("gulp-rename");
2020-07-23 22:51:58 +02:00
const postcssImport = require("postcss-easy-import");
const postcssCSSO = require("postcss-csso");
gulp.task("build-css", buildCSS);
2019-05-28 20:19:48 +02:00
gulp.task("minify-css", minifyCSS);
gulp.task("watch-css", function() {
return gulp.watch(["./src/styles/*.css", "./src/styles/**/*.css"], minifyCSS);
2019-05-28 20:19:48 +02:00
});
2020-07-23 22:51:58 +02:00
function runBuild(minified) {
const plugins = [postcssImport];
if (minified) plugins.push(postcssCSSO({restructure: false}));
2020-07-19 06:34:23 +02:00
return gulp.src("./src/styles/index.css")
2020-07-23 22:51:58 +02:00
.pipe(postcss(plugins))
.pipe(rename("style.css"))
2020-07-19 06:34:23 +02:00
.pipe(gulp.dest("./dist"));
2020-07-23 22:51:58 +02:00
}
function buildCSS() {
return runBuild(false);
}
function minifyCSS() {
return runBuild(true);
2019-05-28 20:19:48 +02:00
}