forked from rannn505/child-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
37 lines (32 loc) · 1.08 KB
/
gulpfile.babel.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
import gulp from "gulp"
import clean from 'gulp-clean'
import babel from 'gulp-babel'
import header from 'gulp-header'
const paths = {
src: { js: './src/**/*.js'},
dest: { js: './dist'}
};
const pkg = require('./package.json');
const banner = ['/*********************************************************',
' * <%= pkg.name %> - <%= pkg.description %>',
' * @version v<%= pkg.version %>',
' * @link <%= pkg.homepage %>',
' * @copyright Copyright (c) 2017 <%= pkg.author %>',
' * @license <%= pkg.license %> (http://www.opensource.org/licenses/mit-license.php)',
' * @Compiled At: ' + new Date().toLocaleDateString(),
' *********************************************************/',
''].join('\n');
gulp.task('clean', function () {
return gulp.src(paths.dest.js)
.pipe(clean({force: true}));
});
gulp.task('build', ['clean'], ()=> {
return gulp.src(paths.src.js)
.pipe(babel())
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest(paths.dest.js));
});
gulp.task('watch', ()=> {
gulp.watch('./src/**/*.js', ['build']);
});
gulp.task('default', ['build']);