-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
35 lines (27 loc) · 824 Bytes
/
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
const { src, dest, series, parallel, watch } = require('gulp');
const sass = require('gulp-sass');
const babel = require('gulp-babel');
const webserver = require('gulp-webserver');
function transpileSass() {
return src('stylesheets/*.scss')
.pipe(sass())
.pipe(dest('stylesheets/bin'))
}
function transpileJs() {
return src('javascripts/*.js')
.pipe(babel({presets: ['@babel/env']}))
.pipe(dest('javascripts/bin'))
}
function watchFiles() {
return watch(['stylesheets/*.scss', 'javascripts/*.js'], exports.build);
}
function startServer() {
return src('.')
.pipe(webserver({
port: 8181
}));
}
exports.build = series(transpileSass, transpileJs);
exports.watch = watchFiles;
exports.server = startServer;
exports.default = parallel(startServer, series(exports.build, watchFiles));