-
Notifications
You must be signed in to change notification settings - Fork 15
/
gulpfile.js
49 lines (30 loc) · 961 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
38
39
40
41
42
43
44
45
46
47
48
49
'use strict';
var gulp = require('gulp');
var del = require('del');
var react = require('gulp-react');
var runSequence = require('run-sequence');
var stripDebug = require('gulp-strip-debug');
var gulpif = require('gulp-if');
gulp.task('clean', function(cb) {
return del(['./dist/css/*', './dist/js/*'], cb);
});
gulp.task('styles', function() {
return gulp.src('./lib/styles/**/*.css')
.pipe(gulp.dest('./dist/css/'));
});
gulp.task('scripts', function() {
return gulp.src('./lib/js/**/*.js')
.pipe(react())
.pipe(gulpif(global.isProd, stripDebug()))
.pipe(gulp.dest('./dist/js/'));
});
gulp.task('dev', function() {
global.isProd = false;
runSequence(['styles', 'scripts']);
gulp.watch('./lib/js/**/*.js', ['scripts']);
gulp.watch('./lib/styles/**/*.css', ['styles']);
});
gulp.task('prod', ['clean'], function() {
global.isProd = true;
return runSequence(['styles', 'scripts']);
});