-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
37 lines (32 loc) · 997 Bytes
/
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
var gulp = require('gulp');
var browserify = require('browserify');
var reactify = require('reactify');
var source = require('vinyl-source-stream');
var sass = require('gulp-sass');
var babelify = require('babelify');
// error handler (so when errors happen, gulp watch won't crash)
function handleError(error) {
console.log("Errors: " + error.toString());
this.emit('end');
}
// client javascript
gulp.task('client_js', function() {
browserify('./public/javascripts/main.js')
.transform(reactify)
.bundle()
.on('error', handleError)
.pipe(source('main.js'))
.pipe(gulp.dest('./public/build'));
});
// stylesheet
gulp.task('styles', function() {
gulp.src(['./public/stylesheets/main.scss'])
.pipe(sass())
.on('error', handleError)
.pipe(gulp.dest('./public/build'))
});
gulp.task('watch', function() {
gulp.watch('./public/javascripts/**/*', ['client_js']);
gulp.watch('./public/stylesheets/*', ['styles']);
});
gulp.task('default', ['watch', 'client_js', 'styles']);