forked from Sparklybot/sparklybot.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
45 lines (35 loc) · 1.15 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
const gulp = require('gulp');
const csso = require('gulp-csso');
const sass = require('gulp-sass');
const postcss = require('gulp-postcss');
const terser = require('gulp-terser');
const webp = require('gulp-webp');
gulp.task('style', function () {
const tailwindCss = require('tailwindcss');
let stream = gulp.src('build/scss/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(postcss([
tailwindCss('./tailwind.config.js'),
require('autoprefixer'),
]));
stream = stream
.pipe(csso())
.pipe(gulp.dest('./css/'));
return stream;
});
gulp.task('js', async function () {
let stream = gulp.src(['./build/js/**/*.js']);
stream = stream.pipe(terser({
keep_fnames: false,
mangle: true
}));
stream = stream.pipe(gulp.dest('./js/'));
return stream;
});
gulp.task('images', async function () {
return gulp.src(['./resources/**/*.jpg', './resources/**/*.png'])
.pipe(webp())
.pipe(gulp.dest('./resources/optimized'));
});
gulp.task('default', gulp.series('style','js','images'));
gulp.task('build', gulp.series('style','js','images'));