This repository has been archived by the owner on Sep 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
109 lines (96 loc) · 2.16 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
102
103
104
105
106
107
108
109
'use strict';
const gulp = require('gulp');
const sass = require('gulp-sass');
const uglify = require('gulp-uglify');
const imagemin = require('gulp-imagemin');
const postcss = require('gulp-postcss');
const tailwindcss = require('tailwindcss');
const purgecss = require('gulp-purgecss');
const babel = require("gulp-babel");
gulp.task('default', ['css','js']);
gulp.task('watch', ['css:watch','js:watch','tailwind:watch']);
/*
*
* SASS, tailwind, postCSS
*
*/
gulp.task('css',function(){
return gulp.src('resources/assets/scss/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(postcss([
tailwindcss('./tailwind.js'),
require('autoprefixer'),
require('cssnano')({
preset: 'default',
}),
]))
.pipe(gulp.dest('public/css'));
});
gulp.task('css:watch', function () {
gulp.watch('resources/assets/scss/**/*.scss', ['css']);
});
gulp.task('tailwind:watch', function () {
gulp.watch('tailwind.js', ['css']);
});
/*
*
* purgeCSS
*
*/
// gulp.task('purge',function(){
// return gulp.src('public/css/*.css')
// .pipe(sass().on('error', sass.logError))
// .pipe(purgecss({
// content: ['']
// }))
// .pipe(gulp.dest('public/css'));
// });
// gulp.task('css:watch', function () {
// gulp.watch('resources/assets/scss/*.scss', ['css']);
// });
/*
*
* js
*
*/
gulp.task('js', function () {
return gulp.src("resources/assets/js/**/*.js")
.pipe(babel())
.pipe(uglify())
.pipe(gulp.dest("public/js"));
});
gulp.task('js:watch', function () {
gulp.watch('resources/assets/js/**/*.js', ['js']);
});
/*
*
* image
*
*/
gulp.task('image', function () {
return gulp.src('resources/assets/img/**/*')
.pipe(imagemin({progressive: true}))
.pipe(gulp.dest('public/img'));
});
gulp.task('image:watch', function () {
gulp.watch('resources/assets/img/**/*', ['image']);
});
/*
*
* favicons
*
*/
gulp.task('favicons', function () {
return gulp.src('resources/assets/favicons/*')
.pipe(imagemin({progressive: true}))
.pipe(gulp.dest('public'));
});
/*
*
* fonts
*
*/
gulp.task('fonts', function () {
return gulp.src('resources/assets/fonts/*')
.pipe(gulp.dest('public/fonts'));
});