Skip to content

Commit 8fd9c01

Browse files
author
Yuan Xie
committed
LEX-88 Enriching gulpfile.js functionality.
1 parent 40e6390 commit 8fd9c01

File tree

12 files changed

+672
-26
lines changed

12 files changed

+672
-26
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
.idea
2-
node_modules
3-
lib
2+
node_modules

gulpfile.js

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,50 @@
11
var gulp = require('gulp');
22
var babel = require('gulp-babel');
3+
var concat = require('gulp-concat');
34
var del = require('del');
45

6+
gulp.task('clean-demo', function(){
7+
return del(['./demo']);
8+
});
9+
510
gulp.task('clean-lib', function(){
6-
return del(['lib']);
11+
return del(['./lib']);
12+
});
13+
14+
gulp.task('build-lib',['clean-lib'], function(){
15+
gulp.src(['./src/hmac.js'])
16+
.pipe(concat('hmac.js'))
17+
.pipe(gulp.dest('./lib/es6'))
18+
.pipe(babel({
19+
presets: ['es2015']
20+
}))
21+
.pipe(gulp.dest('./lib/es5'));
722
});
823

9-
gulp.task('es5',['clean-lib'], function(){
10-
return gulp.src(['src/*.js','example/*.js'])
24+
gulp.task('build-demo',['clean-demo', 'build-lib'], function(){
25+
gulp.src('./src/demo/*.html', {base: './src/demo'})
26+
.pipe(gulp.dest('./demo'));
27+
gulp.src('./src/demo/*.php', {base: './src/demo'})
28+
.pipe(gulp.dest('./demo'));
29+
gulp.src(['./src/hmac.js', './src/demo/get.js'])
30+
.pipe(concat('get.app.js'))
31+
.pipe(babel({
32+
presets: ['es2015']
33+
}))
34+
.pipe(gulp.dest('./demo'));
35+
gulp.src(['./src/hmac.js', './src/demo/post.js'])
36+
.pipe(concat('post.app.js'))
1137
.pipe(babel({
1238
presets: ['es2015']
1339
}))
14-
.pipe(gulp.dest('lib'));
40+
.pipe(gulp.dest('./demo'));
1541
});
1642

17-
gulp.task('default', ['es5'], function() {
43+
gulp.task('default', ['build-demo'], function() {
1844
gulp.watch('src/*.js', function() {
19-
gulp.run('es5');
45+
gulp.run('build-demo');
2046
});
21-
gulp.watch('example/*.js', function() {
22-
gulp.run('es5');
47+
gulp.watch('src/demo/*', function() {
48+
gulp.run('build-demo');
2349
});
2450
});

0 commit comments

Comments
 (0)