-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.babel.js
More file actions
30 lines (24 loc) · 779 Bytes
/
gulpfile.babel.js
File metadata and controls
30 lines (24 loc) · 779 Bytes
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
import del from 'del';
import gulp from 'gulp';
import babel from 'gulp-babel';
import insert from 'gulp-insert';
import chmod from 'gulp-chmod';
import streamqueue from 'streamqueue';
gulp.task('compile-babel', compileBabel);
gulp.task('build', ['lib-clean'], compileBabel);
gulp.task('lib-clean', (cb) => {
del('lib/*', { dot: true })
.then(() => cb());
});
/////////////////////////////////////////////////////////////
function compileBabel() {
return streamqueue({ objectMode: true },
gulp.src('./src/index.js', { base: './src' })
.pipe(babel())
.pipe(insert.prepend('#!/usr/bin/env node\n'))
.pipe(chmod(755)),
gulp.src(['./src/**/*.js', '!./src/index.js'], { base: './src' })
.pipe(babel())
)
.pipe(gulp.dest('./lib/'));
}