-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgulpfile.js
50 lines (36 loc) · 1006 Bytes
/
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
const gulp = require('gulp');
const sass = require('gulp-sass');
const prefix = require('gulp-autoprefixer');
const rename = require('gulp-rename');
const uglify = require('gulp-uglify');
const plumber = require('gulp-plumber');
const connect = require('gulp-connect');
gulp.task('styles', (done) => {
gulp.src('./src/styles.scss')
.pipe(plumber())
.pipe(sass({errLogToConsole: true}))
.pipe(prefix())
.pipe(rename('styles.min.css'))
.pipe(gulp.dest('./build/assets/'));
done();
});
gulp.task('scripts', (done) => {
gulp.src('./src/scripts.js')
.pipe(plumber())
.pipe(uglify())
.pipe(rename('scripts.min.js'))
.pipe(gulp.dest('./build/assets/'))
done();
})
gulp.task('watch', (done) => {
gulp.watch('./src/**/*', gulp.series('styles', 'scripts'));
done();
});
gulp.task('connect', (done) => {
connect.server({
root: 'build',
port: 8080
});
done();
});
gulp.task('default', gulp.parallel('connect', 'styles', 'scripts', 'watch'));