-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
49 lines (45 loc) · 1.16 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
var path=require('path');
var gulp=require('gulp');
var browserify=require('browserify');
var source=require('vinyl-source-stream');
var babelify=require('babelify');
var typescript=require('gulp-typescript');
var del=require('del');
var sass=require('gulp-sass');
const tsproj = typescript.createProject('tsconfig.json', {
typescript: require('typescript'),
});
gulp.task('tsc',function(){
return gulp.src("src/**/*.ts")
.pipe(tsproj())
.js
.pipe(gulp.dest("js/"));
});
gulp.task('jsx',function(){
return browserify({
entries:[path.join(__dirname,"jsx/entrypoint.jsx")],
transform:[babelify.configure({
presets: ['@babel/preset-react'],
})],
extensions:['.js','.jsx'],
basedir:__dirname
})
.bundle()
.pipe(source("components.js"))
.pipe(gulp.dest("dist"));
});
gulp.task('sass',function(){
return gulp.src("sass/**/*.scss")
.pipe(sass().on("error",sass.logError))
.pipe(gulp.dest("dist"));
});
gulp.task('clean',function(cb){
del([
//tsc
"js",
"src/**/*.js",
//jsx,sass
"dist",
],cb);
});
gulp.task('default',['jsx','tsc','sass']);