-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
58 lines (47 loc) · 1.42 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
'use strict';
var gulp = require('gulp');
var nodemon = require('gulp-nodemon');
var browserify = require('browserify');
var react = require('gulp-react');
var source = require('vinyl-source-stream');
var sass = require('gulp-sass');
var config = require('./config/gulp');
var paths = config.paths
var nodemon_instance;
gulp.task('jsx-compile', function() {
return gulp.src(paths.in.jsx)
.pipe(react())
.pipe(gulp.dest(paths.out.build_js));
});
gulp.task('copy-js', function() {
return gulp.src(paths.in.js)
.pipe(gulp.dest(paths.out.build_js));
});
gulp.task('app-compile', ['jsx-compile', 'copy-js'], function() {
return browserify(paths.in.app)
.bundle()
.pipe(source('app.js'))
.pipe(gulp.dest(paths.out.public_js));
});
gulp.task('sass-compile', function() {
return gulp.src(paths.in.sass)
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest(paths.out.public_css));
});
gulp.task('install', ['app-compile', 'sass-compile']);
gulp.task('nodemon', function() {
if(!nodemon_instance)
nodemon_instance = nodemon({
script: 'server.js',
nodeArgs: ['--harmony-generators', '--debug'],
watch: '__manual_watch__',
ext: '__manual_watch__'});
else
nodemon_instance.emit('restart');
});
gulp.task('watch', function() {
gulp.watch(paths.in.jsx, ['app-compile']);
gulp.watch(paths.in.sass, ['sass-compile']);
gulp.watch(paths.toWatch, ['nodemon']);
});
gulp.task('dev', ['install', 'watch', 'nodemon']);