-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
48 lines (39 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
40
41
42
43
44
45
46
47
48
var gulp = require('gulp');
var browserify = require('gulp-browserify');
var concat = require('gulp-concat');
var browserSync = require('browser-sync');
var less = require('gulp-less');
var uglify = require('gulp-uglify');
gulp.task('browserify', function(){
gulp.src('src/js/main.js')
.pipe(browserify({transform: 'reactify'}))
//.pipe(uglify())
.pipe(concat('main.js'))
.pipe(gulp.dest('dist/js'))
});
gulp.task('copy', function(){
gulp.src('src/index.html')
.pipe(gulp.dest('dist'));
});
gulp.task('browser-reload', function() {
browserSync.reload();
});
gulp.task('less', function() {
gulp.src('src/style.less')
.pipe(less())
.pipe(gulp.dest('dist/css'))
});
gulp.task('watch', function() {
gulp.watch('src/**/*.*', ['browserify', 'copy']);
});
gulp.task('watch-bundle', function() {
gulp.watch('dist/**/*.*', ['browser-reload']);
});
gulp.task('browser-sync', function() {
browserSync({
server: {
baseDir: './dist'
}
});
});
gulp.task('default', ['browserify', 'copy', 'less', 'browser-sync', 'watch', 'watch-bundle']);