This repository has been archived by the owner on Mar 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
53 lines (47 loc) · 1.42 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
const gulp = require('gulp');
const sass = require('gulp-sass');
const minifyCSS = require('gulp-csso');
const minifyImg = require('gulp-imagemin');
const minifyJS = require('gulp-uglify');
const concat = require('gulp-concat');
const autoprefixer = require('gulp-autoprefixer');
const del = require('del');
const runSequence = require('run-sequence');
gulp.task('css', () => {
return gulp.src('resources/assets/css/**/*.css')
.pipe(sass({
outputStyle: 'nested',
precision: 10,
includePaths: ['.']
}).on('error', sass.logError))
.pipe(minifyCSS())
.pipe(autoprefixer())
.pipe(concat('app.min.css'))
.pipe(gulp.dest('public/css'))
});
gulp.task('js', () => {
return gulp.src('resources/assets/js/**/*.js')
.pipe(concat('app.min.js'))
.pipe(minifyJS())
.pipe(gulp.dest('public/js'))
});
gulp.task('img', () => {
gulp.src('resources/assets/img/**/*')
.pipe(minifyImg())
.pipe(gulp.dest('public/img'));
});
gulp.task('delete', () => del(['public/css', 'public/js', 'public/img']));
gulp.task('watch', () => {
gulp.watch("resources/assets/css/**/*.css", ['css']);
gulp.watch("resources/assets/js/**/*.js", ['js']);
gulp.watch("resources/assets/img/**/*", ['img']);
});
gulp.task('default', () => {
runSequence(
'delete',
'css',
'js',
'img',
'watch'
);
});