-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathgulpfile.js
81 lines (67 loc) · 1.89 KB
/
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
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
var browserify = require('browserify');
var gulp = require('gulp');
var babel = require('gulp-babel');
var rename = require('gulp-rename');
var streamify = require('gulp-streamify');
var uglify = require('gulp-uglify');
var source = require('vinyl-source-stream');
process.env.NODE_ENV = 'production';
gulp.task('prod', function() {
return gulp.src('./src/anychart-react.jsx')
.pipe(babel({
presets: ['es2015', 'react']
}))
.pipe(uglify())
.pipe(rename('anychart-react.min.js'))
.pipe(gulp.dest('./dist/'));
});
gulp.task('dev', function() {
return gulp.src('./src/anychart-react.jsx')
.pipe(babel({
presets: ['es2015', 'react']
}))
.pipe(rename('anychart-react.js'))
.pipe(gulp.dest('./dist/'));
});
gulp.task('default', ['dev', 'prod']);
/*
* Tasks for examples.
*/
var pipeline = function(name) {
browserify({
entries: ['./examples/src/' + name + '.js'],
transform: [
["babelify", {"presets": ["es2015", "react"]}]
]
})
.bundle()
.pipe(source(name + '.min.js'))
.pipe(streamify(uglify()))
.pipe(gulp.dest('./examples/' + name))
};
gulp.task('chart_with_json', function() {
pipeline('chart_with_json')
});
gulp.task('multiseries_column_chart', function() {
pipeline('multiseries_column_chart')
});
gulp.task('charts_with_controls', function() {
pipeline('charts_with_controls')
});
gulp.task('choropleth_map', function() {
pipeline('choropleth_map')
});
gulp.task('data_streaming', function() {
pipeline('data_streaming')
});
gulp.task('simple_dashboard', function() {
pipeline('simple_dashboard')
});
gulp.task('stock', function() {
pipeline('stock')
});
gulp.task('tabs', function() {
pipeline('tabs')
});
var allExamples = ['chart_with_json', 'charts_with_controls', 'choropleth_map', 'data_streaming', 'multiseries_column_chart', 'simple_dashboard', 'stock', 'tabs'];
gulp.task('examples', allExamples);