-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.babel.js
55 lines (45 loc) · 1.1 KB
/
gulpfile.babel.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
import gulp from 'gulp';
import sass from 'gulp-sass';
import browserSync from 'browser-sync';
const server = browserSync.create();
function scripts() {
return gulp.src(['src/assets/js/*.js']).pipe(gulp.dest('dist/assets/js'));
}
function styles() {
return gulp
.src(['src/assets/scss/styles.scss'])
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('dist/assets/css'));
}
function tiles() {
return gulp
.src(['src/assets/tiled/**/*'])
.pipe(gulp.dest('dist/assets/tiled/'));
}
function template() {
return gulp.src(['src/index.html']).pipe(gulp.dest('dist/'));
}
function reload(done) {
server.reload();
done();
}
function serve(done) {
server.init({
server: './dist'
});
done();
}
function build(done) {
tiles();
template();
scripts();
styles();
done();
}
function watch() {
gulp.watch('./src/assets/scss/**/*.scss', gulp.series(styles, reload));
gulp.watch('./src/assets/js/**/*.js', gulp.series(scripts, reload));
gulp.watch('./src/*.html', gulp.series(template, reload));
}
const demo = gulp.series(build, serve, watch);
export default demo;