This repository has been archived by the owner on Nov 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
45 lines (38 loc) · 1.15 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
var gulp = require('gulp');
var browserify = require('browserify');
var reactify = require('reactify');
var uglify = require('gulp-uglify');
var source = require('vinyl-source-stream');
var dist = 'app/assets/javascripts';
gulp.task('background', function() {
var b = browserify('app/src/background.js');
return b.bundle()
.pipe(source('background.bundle.js'))
.pipe(gulp.dest(dist));
});
gulp.task('popup', function() {
var b = browserify({
entries: 'app/src/popup.jsx',
transform: [reactify]
});
return b.bundle()
.pipe(source('popup.bundle.js'))
.pipe(gulp.dest(dist));
});
gulp.task('oauth', function() {
var b = browserify('app/src/oauth.js')
return b.bundle()
.pipe(source('oauth.bundle.js'))
.pipe(gulp.dest(dist))
});
gulp.task('build_prod', ['build'], function() {
gulp.src('app/assets/javascripts/*.bundle.js')
.pipe(uglify())
.pipe(gulp.dest('app/assets/javascripts'));
});
gulp.task('build', ['background', 'popup', 'oauth']);
gulp.task('watch', function() {
gulp.watch(['app/src/*.js', 'app/src/*.jsx'], ['build']);
});
gulp.task('default', ['watch', 'build']);
gulp.task('prod', ['build_prod']);