-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgulpfile.js
45 lines (38 loc) · 1.04 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
const gulp = require('gulp');
const babel = require('gulp-babel');
const connect = require('gulp-connect');
const plumber = require('gulp-plumber');
const pug = require('gulp-pug');
const stylus = require('gulp-stylus');
gulp.task('stylus', () => {
return gulp.src('src/styles/*.styl')
.pipe(plumber())
.pipe(stylus())
.pipe(gulp.dest('dist/css'))
.pipe(connect.reload())
});
gulp.task('pug', () => {
return gulp.src('src/index.pug')
.pipe(plumber())
.pipe(pug())
.pipe(gulp.dest('dist'))
.pipe(connect.reload())
});
gulp.task('babel', () => {
return gulp.src('src/scripts/*.js')
.pipe(plumber())
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('dist/js'))
.pipe(connect.reload())
});
gulp.task('default', ['pug', 'stylus', 'babel'], () => {
connect.server({
root: 'dist',
livereload: true
});
gulp.watch(['src', 'src/**/*.pug'], ['pug']);
gulp.watch(['src/styles', 'src/styles/**/*.styl'], ['stylus']);
gulp.watch(['src/scripts', 'src/scripts/**/*.js'], ['babel']);
})