-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
62 lines (52 loc) · 2.24 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
var del = require('del');
var gulp = require('gulp');
var header = require('gulp-header');
var minify = require('gulp-minify');
var cleanCss = require('gulp-clean-css');
var rename = require('gulp-rename');
var fs = require('fs')
var json = JSON.parse(fs.readFileSync('./package.json'))
gulp.task('clean', function () {
return del(['dist/**', 'gh-pages/**'], { force: true });
});
gulp.task('minify-js', function () {
return gulp.src('ichatbot/ichatbot.js')
.pipe(minify({
noSource: true,
ext: {
min: '-' + json.version + '.min.js',
}
}))
.pipe(header('/* ichatbot library v' + json.version + ' *************** */ \n'))
.pipe(gulp.dest('dist/'))
});
gulp.task('minify-css', function () {
return gulp.src('ichatbot/ichatbotstyle.css')
.pipe(cleanCss())
.pipe(rename({ suffix: '-' + json.version + '.min' }))
.pipe(header('/* ichatbot library v' + json.version + ' *************** */ \n'))
.pipe(gulp.dest('dist/'));
});
gulp.task('copy-original-files', function () {
return gulp.src(['ichatbot/ichatbotstyle.css', 'ichatbot/ichatbot.js'])
.pipe(rename({ suffix: '-' + json.version }))
.pipe(header('/* ichatbot library v' + json.version + ' *************** */ \n'))
.pipe(gulp.dest('dist/'))
});
gulp.task('copy-files', function () {
return gulp.src(['ichatbot/ichatbotconfig.js', 'copycmd.js', 'package.json','README.md'])
.pipe(gulp.dest('dist/'))
});
gulp.task('copy-gh-files', function () {
return gulp.src(['ichatbot/ichatbotconfig.js', 'ichatbot/ichatbotstyle.css', 'ichatbot/ichatbot.js', 'ichatbot/index.html',
'ichatbot/dataset-basic-workflow.js', 'ichatbot/dataset-complex-workflow.js', 'ichatbot/dataset-fileupload-workflow.js',
'README.md'])
.pipe(gulp.dest('gh-pages/'))
});
gulp.task('copy-gh-images', function () {
return gulp.src(['images/complex.gif', 'images/fileupload.gif',
'images/ichatbotconfig.png', 'images/basic.gif'])
.pipe(gulp.dest('gh-pages/images/'))
});
gulp.task('release', gulp.series('clean', 'minify-js', 'minify-css', 'copy-original-files', 'copy-files'));
gulp.task('gh-pages', gulp.series('copy-gh-files', 'copy-gh-images'));