-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
67 lines (59 loc) · 1.49 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
const gulp = require('gulp');
const autoprefixer = require('gulp-autoprefixer');
const plumber = require('gulp-plumber');
const pug = require('gulp-pug');
const sass = require('gulp-dart-sass');
const ts = require('gulp-typescript');
const uglify = require('gulp-uglify');
const livereload = require('gulp-livereload');
const tsClient = ts.createProject('src/tsconfig.json');
const scripts = () => (
tsClient.src()
.pipe(plumber())
.pipe(tsClient())
// .pipe(uglify())
.pipe(gulp.dest('build'))
.pipe(livereload())
);
const styles = () => (
// Exclude files starting with an underscore.
gulp.src([
'src/**/!(_)*.scss',
'src/**/!(_)*.sass',
])
.pipe(plumber())
.pipe(sass({ includePaths: ['src'] }))
.pipe(autoprefixer({ cascade: false }))
.pipe(sass({ outputStyle: 'compressed' }))
.pipe(gulp.dest('build'))
.pipe(livereload())
);
const pages = () => (
// Exclude files starting with an underscore.
gulp.src('src/**/!(_)*.pug')
.pipe(plumber())
.pipe(pug())
.pipe(gulp.dest('build'))
.pipe(livereload())
);
const template = () => (
gulp.src('template/**/!(_)*.pug')
.pipe(plumber())
.pipe(livereload())
);
const watch = () => {
livereload.listen();
gulp.watch('src/**/*.(scss|sass)', styles);
gulp.watch('src/**/*.ts', scripts);
gulp.watch('src/**/*.pug', pages);
gulp.watch('template/**/*.pug', template);
};
const build = gulp.parallel(scripts, styles, pages);
module.exports = {
scripts: scripts,
styles: styles,
pages: pages,
template: template,
build: build,
watch: watch,
};