-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
70 lines (59 loc) · 1.51 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
70
var gulp = require('gulp');
var shell = require('gulp-shell')
var del = require('del');
var ghPages = require('gulp-gh-pages');
const gulpReplace = require('gulp-replace')
// 删除之前生成的dist目录
gulp.task('clean', function (cb) {
return del([
'.nodeppt/dist/',
'.vuepress/dist/',
// '.publish/'
], cb);
});
// 搬运图片
gulp.task('copyVuepressStatic', function () {
// 搬运图片
return gulp.src([
`static/**/*.*`
])
.pipe(gulp.dest(`.vuepress/public/static`))
})
gulp.task('copyNodePPTStatic', function () {
// 搬运图片
return gulp.src([
`static/**/*.*`
])
.pipe(gulp.dest(`.nodeppt/static`))
})
// vuepress打包文件路径替换
gulp.task('cdnPre', function() {
return gulp
.src([
'.vuepress/dist/**/*.{html,js}',
])
.pipe(
gulpReplace(/(?<!blog-web\/)static\/images/g, 'blog-web/static/images')
)
.pipe(gulp.dest('.vuepress/dist'));
});
// shell中执行命令生成文件
gulp.task('build', ['clean'], () => {
return gulp.src('*.js', {
read: false
})
.pipe(shell([
'nodeppt generate .nodeppt .nodeppt/dist -a'
]))
})
// 部署到github pages上
gulp.task('deploy', ['build'], () => {
return gulp.src('./dist/**/*')
.pipe(ghPages({
// origin: 'gh-pages',
remoteUrl: '[email protected]:luo0412/ppt-web.git',
force: true
}))
});
// gulp.task('deploy', shell.task('npm run deploy:nodeppt'));
gulp.task('default', ['deploy']);