-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (53 loc) · 1.37 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
56
57
58
59
60
61
var gulp = require('gulp');
var browserSync = require('browser-sync');
var config = {
dest: 'public'
};
// Static server
gulp.task('server', function() {
gulp.watch('src/js/**/*.jsx', ['js']);
gulp.watch('src/css/**/*.styl', ['css']);
gulp.watch('src/html/**/*.jade', ['html']);
browserSync({
port: 8888,
server: {
baseDir: config.dest
}
});
});
var reload = browserSync.reload;
var react = require('gulp-react');
var browserify = require('gulp-browserify');
var plumber = require('gulp-plumber');
gulp.task('js', function() {
var js_path = config.dest + '/js';
gulp.src('src/js/*.jsx')
.pipe(plumber())
.pipe(react())
.pipe(browserify({
insertGlobals : true,
debug : !gulp.env.production
}))
.pipe(gulp.dest(js_path))
.pipe(reload({stream: true}));
gulp.src('src/js/*.js')
.pipe(gulp.dest(js_path));
});
var stylus = require('gulp-stylus');
gulp.task('css', function() {
gulp.src('src/css/*.styl')
.pipe(plumber())
.pipe(stylus())
.pipe(gulp.dest(config.dest + '/css'))
.pipe(reload({stream: true}));
});
var jade = require('gulp-jade');
gulp.task('html', function() {
gulp.src('src/html/**/*.jade')
.pipe(plumber())
.pipe(jade())
.pipe(gulp.dest(config.dest))
.pipe(reload({stream: true}));
});
gulp.task('build', ['js','css','html']);
gulp.task('default',['build','server']);