-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
60 lines (47 loc) · 1.47 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
var gulp = require('gulp')
var pug = require('gulp-pug')
var stylus = require('gulp-stylus')
var typescript = require('gulp-typescript')
var browserSync = require('browser-sync').create()
var src = './src'
var dist = './dist'
var input = {
pages: `${src}/pages`,
styles: `${src}/styles`,
scripts: `${src}/scripts`
}
var output = {
pages: `${dist}`,
styles: `${dist}/styles`,
scripts: `${dist}/scripts`
}
var pages = () => gulp.src(`${input.pages}/*.pug`)
.pipe(pug({pretty: true}))
.pipe(gulp.dest(`${output.pages}/`))
.pipe(browserSync.stream())
var styles = () => gulp.src(`${input.styles}/*.styl`)
.pipe(stylus())
.pipe(gulp.dest(`${output.styles}/`))
.pipe(browserSync.stream())
var scripts = () => gulp.src(`${input.scripts}/*.ts`)
.pipe(typescript())
.pipe(gulp.dest(`${output.scripts}/`))
.pipe(browserSync.stream())
var watch = () => {
browserSync.init({
server: {
baseDir: dist
}
})
gulp.watch(`${input.pages}/**/*.pug`, pages)
gulp.watch(`${input.styles}/**/*.styl`, styles)
gulp.watch(`${input.scripts}/**/*.ts`, scripts)
gulp.watch(`${input.pages}/**/*.pug`).on('change', browserSync.reload)
gulp.watch(`${input.styles}/**/*.styl`).on('change', browserSync.reload)
gulp.watch(`${input.scripts}/**/*.ts`).on('change', browserSync.reload)
}
exports.pages = pages
exports.styles = styles
exports.scripts = scripts
exports.watch = watch
exports.default = watch