-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathgulpfile.js
32 lines (26 loc) · 822 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
const gulp = require('gulp')
const fs = require('fs')
const del = require('del')
const inlineStr = require('gulp-inline-str')
const babel = require('gulp-babel')
const babelOptions = JSON.parse(fs.readFileSync('./.babelrc', 'utf8'))
const paths = {
scripts: [ 'src/index.js'],
destination: './lib',
}
gulp.task('clean', function() {
return del([ paths.destination + '/*.js' ])
})
gulp.task('build', function() {
return gulp
.src(paths.scripts)
.pipe(inlineStr({ basePath: paths.destination }))
.pipe(babel(babelOptions))
.pipe(gulp.dest(paths.destination))
})
// Rerun the task when a file changes
gulp.task('watch', function() {
gulp.watch(paths.scripts, gulp.series([ 'build' ]))
})
// The default task (called when you run `gulp` from cli)
gulp.task('default', gulp.series([ 'build' ]))