-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
69 lines (61 loc) · 1.39 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const gulp = require('gulp')
var rename = require('gulp-rename')
var gap = require('gulp-append-prepend')
let postcss = require('gulp-postcss')
gulp.task('r', function() {
let appModule = require('./template/app')
gulp
.src('./dist/index.js')
.pipe(gap.prependText(appModule.bef))
.pipe(
rename(function(path) {
path.basename = 'app'
})
)
.pipe(gulp.dest('./dist'))
})
gulp.task('i', function () {
gulp
.src('./src/_package.json')
.pipe(
rename(function(p) {
p.basename = 'package'
})
)
.pipe(gulp.dest('./dist'))
})
gulp.task('w', function() {
console.log('start gulp watch')
gulp
.src('./dist/app.wxss')
.pipe(postcss())
.pipe(gulp.dest('./dist'))
gulp
.src('./src/_package.json')
.pipe(
rename(function(p) {
p.basename = 'package'
})
)
.pipe(gulp.dest('./dist'))
gulp.watch('./dist/index.js', ['r'])
gulp.watch('./dist/app.wxss', function() {
return gulp
.src('./dist/app.wxss')
.pipe(postcss())
.pipe(gulp.dest('./dist'))
})
gulp.watch('./src/_package.json', function() {
return gulp
.src('./src/_package.json')
.pipe(
rename(function(p) {
p.basename = 'package'
})
)
.pipe(gulp.dest('./dist'))
.on('end', function() {
console.log('transform _package.json');
});
})
})