-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgulpfile.js
More file actions
54 lines (50 loc) · 1.19 KB
/
gulpfile.js
File metadata and controls
54 lines (50 loc) · 1.19 KB
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
var gulp = require('gulp');
var path = require('path');
var react = require('gulp-react');
var concat = require('gulp-concat');
var validatorFiles = ['required.jsx', 'minlength.jsx', 'longerthan.jsx'].map(function(f) {
return path.join('validators', f);
});
var editorFiles = ['text.jsx', 'textarea.jsx'].map(function(f) {
return path.join('editors', f);
});
var presenterFiles = ['text.jsx'].map(function(f) {
return path.join('presenters', f);
});
var files = [
'wrap_begin.js',
'utils.jsx',
'templatehelper.jsx',
'promise.jsx',
'validator.jsx',
'mixins.jsx',
'editor.jsx',
'presenters.jsx',
].concat(validatorFiles, editorFiles, presenterFiles, [
'label.jsx',
'title.jsx',
'validationclassstatus.jsx',
'form.jsx',
'presenter.jsx',
'wrap_end.js',
]);
gulp.task('build', function() {
return gulp
.src(
files.map(function(e) {
return path.join('src', e);
})
)
.pipe(concat('shift.jsx'))
.pipe(gulp.dest('js'))
.pipe(react({ harmony: true }))
.on('error', function(e) {
console.warn(e.message);
console.warn(e.stack);
})
.pipe(gulp.dest('js'));
});
gulp.task('watch', function() {
gulp.watch(['src/**/*.jsx'], ['build']);
});
gulp.task('default', ['build', 'watch']);