forked from gilbarbara/react-inlinesvg
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
81 lines (70 loc) · 1.82 KB
/
Copy pathgulpfile.js
File metadata and controls
81 lines (70 loc) · 1.82 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
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
/*eslint-disable no-var, one-var, func-names, indent, prefer-arrow-callback, object-shorthand, no-console, newline-per-chained-call, one-var-declaration-per-line, vars-on-top */
var gulp = require('gulp'),
browserify = require('browserify'),
$ = require('gulp-load-plugins')(),
cors = require('cors'),
source = require('vinyl-source-stream');
function bump(type) {
return gulp.src(['./bower.json', './package.json'])
.pipe($.bump({ type: type }))
.pipe(gulp.dest('./'));
}
gulp.task('bump:major', function() {
return bump('major');
});
gulp.task('bump:minor', function() {
return bump('minor');
});
gulp.task('bump:patch', function() {
return bump('patch');
});
gulp.task('watch', function() {
gulp.watch('./src/**/*', ['build']);
});
gulp.task('build:node', function() {
return gulp.src('./src/**/*.js')
.pipe($.babel({
presets: [
'es2015',
'react',
'stage-1'
],
plugins: [
'add-module-exports'
]
}))
.pipe(gulp.dest('./lib'));
});
gulp.task('build:browser', function() {
var bundler, stream;
bundler = browserify({
entries: './src/index.js',
standalone: 'ReactInlineSVG'
});
stream = bundler.bundle();
return stream
.pipe(source('react-inlinesvg.js'))
.pipe(gulp.dest('./standalone/'));
});
gulp.task('localserver', function() {
return $.connect.server({
root: [__dirname],
port: 1337,
livereload: false,
middleware: function() {
return [cors()];
}
});
});
gulp.task('xdomainserver', function() {
return $.connect.server({
root: [__dirname],
port: 1338,
livereload: false,
middleware: function() {
return [cors()];
}
});
});
gulp.task('build', ['build:node', 'build:browser']);
gulp.task('test-server', ['localserver', 'xdomainserver']);