-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathgulpfile.js
44 lines (38 loc) · 949 Bytes
/
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
const gulp = require('gulp');
const browserify = require('browserify');
const source = require('vinyl-source-stream');
const notify = require('gulp-notify');
const path = {
SRC: 'lib/BluetoothDevice.js',
NPM_Dest: 'dist/npm',
BOWER_Dest: 'dist/build.js'
}
const configs = {
npm: {
entries: [`./lib/${file}`],
debug: true,
transform: [
['babelify', { presets: ['es2015'] }]
]
},
bower: {
entries:
}
}
function handleErrors() {
notify.onError({
title : 'Compile Error',
message : '<%= error.message %>'
}).apply(this, arguments);
this.emit('end'); //keeps gulp from hanging on this task
}
function build(props, src, out) {
return browserify(props)
.bundle()
.on('error', handleErrors)
.pipe(soucre(src))
.pipe(source(out));
}
gulp.task('default', ['npm', 'bower']);
gulp.task('npm', build.call(this, path.SRC, path.NPM_Dest));
gulp.task('bower', build.call(this, path.SRC, path.BOWER_Dest));