-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.ts
50 lines (42 loc) · 1.03 KB
/
gulpfile.ts
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
import { task, src, watch, dest, series } from 'gulp'
import pug from 'gulp-pug'
import sass, { logError } from 'gulp-sass'
import { createProject } from 'gulp-typescript'
import { create, stream, init, reload } from 'browser-sync'
const tsProject = createProject('tsconfig.json')
create()
//taks
task('pug', () => {
return src('./src/pages/*.pug')
.pipe(
pug({
pretty: false,
}),
)
.pipe(dest('./public/'))
})
task('sass', () => {
return src('./src/scss/*.scss')
.pipe(
sass({
outputStyle: 'compressed',
}).on('error', logError),
)
.pipe(dest('./public/css/'))
.pipe(stream())
})
task('scripts', () => {
return src('./src/ts/*.ts')
.pipe(tsProject())
.pipe(dest('./public/js/'))
})
task('default', () => {
init({
server: './public',
})
//PUG
watch('./src/pages/*.pug', series('pug')).on('change', reload)
//SASS
watch('./src/scss/*.scss', series('sass')).on('change', reload)
watch('./src/ts/*.ts', series('scripts')).on('change', reload)
})