-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathgulpfile.js
More file actions
37 lines (33 loc) · 802 Bytes
/
Copy pathgulpfile.js
File metadata and controls
37 lines (33 loc) · 802 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
31
32
33
34
35
36
37
const gulp = require('gulp')
const oss = require('gulp-alioss-upload')
const appConfig = require('./config/config')
const ossOptions = {
...appConfig.oss[process.env.BUILD_ENV],
path: appConfig.oss.path,
prefix: appConfig.oss.prefix,
formats: appConfig.oss.formats,
}
function uploadOss() {
return gulp
.src([
'./dist/**/*.js',
'./dist/**/*.json',
'./dist/**/*.wxss',
'./dist/**/*.wxml',
], { since: gulp.lastRun(uploadOss) })
.pipe(oss(ossOptions))
.pipe(gulp.dest('./dist/'))
}
gulp.task('upload:oss', uploadOss)
gulp.task('watch', function() {
return gulp.watch(
[
'./dist/**/*.js',
'./dist/**/*.json',
'./dist/**/*.wxss',
'./dist/**/*.wxml',
],
{ delay: 1000, ignoreInitial: false },
uploadOss,
)
})