forked from ovity/octotree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
54 lines (47 loc) · 1.56 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
var gulp = require('gulp')
, clean = require('gulp-clean')
, es = require('event-stream')
, rseq = require('gulp-run-sequence')
function pipe(src, transforms, dest) {
if (typeof transforms === 'string') {
dest = transforms
transforms = null
}
var stream = gulp.src(src)
transforms && transforms.forEach(function(transform) {
stream = stream.pipe(transform)
})
if (dest) stream = stream.pipe(gulp.dest(dest))
return stream
}
gulp.task('clean', function() {
return pipe('./tmp', [clean()])
})
gulp.task('chrome', function() {
return es.merge(
pipe('./src/lib/**/*', './tmp/chrome/lib'),
pipe('./src/icons/**/*', './tmp/chrome/icons'),
pipe(['./src/inject.js', './src/inject.css', './src/manifest.json'], './tmp/chrome/')
)
})
gulp.task('safari', function() {
return es.merge(
pipe('./src/lib/**/*', './tmp/safari/octotree.safariextension/lib'),
pipe('./src/icons/**/*', './tmp/safari/octotree.safariextension/icons'),
pipe(['./src/inject.js', './src/inject.css', './src/Info.plist'], './tmp/safari/octotree.safariextension/')
)
})
gulp.task('firefox', function() {
return es.merge(
pipe('./src/lib/**/*', './tmp/firefox/data/lib'),
pipe('./src/icons/**/*', './tmp/firefox/data/icons'),
pipe(['./src/inject.js', './src/inject.css', './src/firefox.js'], './tmp/firefox/data'),
pipe('./src/package.json', './tmp/firefox')
)
})
gulp.task('default', function(cb) {
return rseq('clean', ['chrome', 'safari', 'firefox'], cb)
})
gulp.task('watch', function() {
gulp.watch(['./src/**/*'], ['default'])
})