-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (46 loc) · 1.56 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
50
51
52
53
54
55
const gulp = require('gulp');
const browserify = require('browserify');
const babelify = require('babelify');
const babel = require('babel-register');
const source = require('vinyl-source-stream');
//const sass = require('gulp-sass');
const mocha = require('gulp-mocha');
const server = require('gulp-develop-server');
gulp.task('js', function () {
return browserify({entries: './src/app.js', extensions: ['.js'], debug: true})
.transform('babelify', {presets: ['es2015', 'es2016', 'es2017', 'react', 'stage-0']})
.bundle()
.pipe(source('app.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('images', function () {
return gulp.src('./images/*.jpg')
.pipe(gulp.dest('./dist/images'));
});
gulp.task('js:watch', function () {
gulp.watch('./src/**/*.js', ['js']);
});
// gulp.task('sass', function () {
// return gulp.src(['./src/bootstrap.scss', './src/style.scss'])
// .pipe(sass().on('error', sass.logError))
// .pipe(gulp.dest('./dist'));
// });
// gulp.task('sass:watch', function () {
// gulp.watch('./src/**/*.scss', ['sass']);
// });
gulp.task('test', function () {
return gulp.src('./test/*.spec.js', {read: false})
.pipe(mocha({
compilers: babel,
require: ['./setupTest.js']
}));
});
gulp.task('server', function () {
server.listen( { path: './index.js' } );
});
gulp.task('server:watch', function () {
gulp.watch( [ './server.js' ], server.restart );
});
gulp.task('default', function () {
gulp.start('js', 'js:watch', 'images', 'server', 'server:watch');
});