-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
39 lines (33 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
const gulp = require('gulp');
const sass = require('gulp-sass');
const tsConfig = require('./tsconfig.json');
const browserify = require('browserify');
const glob = require('glob');
const source = require('vinyl-source-stream');
const browserSync = require('browser-sync').create();
gulp.task('scss', () => {
return gulp.src('./scss/style.scss')
.pipe(sass())
.pipe(gulp.dest('./public/css'));
});
gulp.task('js', () => {
const files = glob.sync('./scripts/**/*.ts');
return browserify(files)
.plugin('tsify', tsConfig)
// .plugin('tinyify')
.bundle()
.pipe(source('index.js'))
.pipe(gulp.dest('./public/js'));
})
gulp.task('reload-browser', (done) => {
browserSync.reload();
done();
});
gulp.task('serve', gulp.series('js', 'scss', (done) => {
browserSync.init({
proxy: 'localhost:3000'
});
gulp.watch(['./scss/**/*.scss'], gulp.series(['scss', 'reload-browser']));
gulp.watch(['./scripts/**/*.ts'], gulp.series(['js', 'reload-browser']));
done();
}));