-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
58 lines (44 loc) · 1.21 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
var gulp = require('gulp');
var concat = require('gulp-concat');
var cleanCss = require('gulp-clean-css');
var sass = require('gulp-sass')(require('sass'));
var sassGlob = require('gulp-sass-glob');
var plumber = require('gulp-plumber');
var uglify = require('gulp-uglify');
var prefix = require('gulp-autoprefixer');
var flatten = require('gulp-flatten');
var connect = require('gulp-connect');
gulp.task('styles', function (done) {
gulp.src(['./assets/styles/app.scss'])
.pipe(plumber())
.pipe(sassGlob())
.pipe(sass({
errLogToConsole: true
}))
.pipe(prefix())
.pipe(concat('styles.min.css'))
.pipe(cleanCss({
compatibility: 'ie9'
}))
.pipe(gulp.dest('./public/'))
done();
})
gulp.task('scripts', function (done) {
gulp.src(['./assets/scripts/*.js'])
.pipe(plumber())
.pipe(uglify())
.pipe(concat('scripts.min.js'))
.pipe(gulp.dest('./public/'))
done();
})
gulp.task('watch', function (done) {
gulp.watch('./assets/**/*', gulp.series('styles', 'scripts'));
done();
})
gulp.task('connect', function (done) {
connect.server({
root: './public'
});
done();
})
gulp.task('default', gulp.parallel('connect', 'styles', 'scripts', 'watch'));