forked from kevinwang04/order-class-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
48 lines (40 loc) · 1.21 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
var gulp = require('gulp');
var babelify = require('babelify');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var livereload = require('gulp-livereload');
var uglify = require('gulp-uglify');
gulp.task('build', function () {
return browserify('./src/js/main.js')
.transform('babelify', {presets: ['es2015', 'react']})
.bundle()
.pipe(source('main.min.js'))
.pipe(gulp.dest('./backend/js/'))
.pipe(livereload());
});
gulp.task('min', function () {
gulp.src('./backend/js/main.min.js')
.pipe(uglify())
.pipe(gulp.dest('./backend/js/'))
});
gulp
// moves source files to backend
.task('copy', function(){
gulp
.src('src/index.html')
.pipe(gulp.dest('backend'));
gulp
.src('src/assets/**/*.*')
.pipe(gulp.dest('backend/assets'));
gulp
.src('src/img/**/*.*')
.pipe(gulp.dest('backend/img'));
})
// build the application
// .task('default', ['browserify','copy', 'connect', 'open'])
.task('default', ['build', 'copy'])
// watch for source changes
.task('watch', ['default'], function(){
// livereload.listen();
gulp.watch('src/**/*.*', ['default']);
});