-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.babel.js
93 lines (79 loc) · 2.08 KB
/
gulpfile.babel.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
'use strict';
import gulp from 'gulp';
import babel from 'gulp-babel';
import concat from 'gulp-concat';
import shell from 'gulp-shell';
import uglify from 'gulp-uglify';
import webpack from 'gulp-webpack';
import merge from 'merge-stream';
const componentPath = './src/suggestible-input.jsx';
gulp.task('component', function () {
return gulp
.src(componentPath)
.pipe(concat('suggestible-input.js'))
.pipe(babel())
.pipe(uglify())
.pipe(gulp.dest('dist/'));
});
gulp.task('example-basic', function () {
var js = gulp
.src('examples/src/basic/basic.jsx')
.pipe(webpack({
output: {
filename: 'basic.js'
},
module: {
loaders: [
{ test: /\.jsx$/, loader: 'babel-loader' }
]
},
externals: {
'react': 'React',
'react-dom': 'ReactDOM'
}
}))
.pipe(gulp.dest('examples/dist/basic/'));
var staticFiles = gulp
.src([
'examples/src/basic/basic.css',
'examples/src/basic/close-round.svg',
'examples/src/basic/index.html'
])
.pipe(gulp.dest('examples/dist/basic/'));
return merge(js, staticFiles);
});
gulp.task('example-objects', function () {
var js = gulp
.src('examples/src/objects/objects.jsx')
.pipe(webpack({
output: {
filename: 'objects.js'
},
module: {
loaders: [
{ test: /\.jsx$/, loader: 'babel-loader' }
]
},
externals: {
'react': 'React',
'react-dom': 'ReactDOM'
}
}))
.pipe(gulp.dest('examples/dist/objects/'));
var staticFiles = gulp
.src([
'examples/src/objects/objects.css',
'examples/src/objects/close-round.svg',
'examples/src/objects/index.html'
])
.pipe(gulp.dest('examples/dist/objects/'));
return merge(js, staticFiles);
});
// TODO: Make some tests. Prefer mocha/chai :)
gulp.task('test', function () {
});
gulp.task('lint', shell.task([
`./node_modules/eslint/bin/eslint.js ${componentPath}; exit 0`
]));
gulp.task('build', ['component', 'example-basic', 'example-objects']);
gulp.task('default', ['build']);