-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
52 lines (44 loc) · 1.24 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
const gulp = require('gulp');
const pug = require('gulp-pug');
//const browserify = require('gulp-browserify');
const browserify = require('browserify');
const concat = require('gulp-concat');
const uglify = require('gulp-uglify');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const autoprefixer = require('gulp-autoprefixer');
const csso = require('gulp-csso');
gulp.task('pug', () => {
return gulp.src('client/pug/index.pug')
.pipe(pug())
.pipe(gulp.dest('dist'));
});
gulp.task('css', () => {
return gulp.src('client/styles/*.css')
.pipe(concat('styles.css'))
.pipe(autoprefixer())
.pipe(csso())
.pipe(gulp.dest('dist'));
});
gulp.task('browserify', () => {
return browserify('./client/js/main.js')
.bundle()
.pipe(source('bundle.js'))
.pipe(buffer())
.pipe(uglify())
.pipe(gulp.dest('./dist'));
});
gulp.task('copyStatic', () => {
/*
gulp.src('client/manifest.webmanifest')
.pipe(gulp.dest('dist'));
gulp.src('client/sw.js')
.pipe(gulp.dest('dist'));
*/
return gulp.src('client/img/*')
.pipe(gulp.dest('dist/img'));
});
gulp.task('build', gulp.parallel('pug', 'css', 'browserify', 'copyStatic'));
gulp.task('watch', () => {
gulp.watch('./client/**/*', gulp.series('build'));
});