var gulp = require('gulp');
var webpack = require('webpack-stream');

var client = {
    config: require('./config/webpack.prod.client.js'),
    in: './src/client/index.jsx'
}, server = {
    config: require('./config/webpack.prod.server.js'),
    in: './src/server/index.js'
};

gulp.task('bundle-client', function() {
    return gulp.src( client.in )
        .pipe( webpack( client.config ) )
        .pipe( gulp.dest('./app/') )
});

gulp.task('bundle-server', function() {
    return gulp.src( server.in )
        .pipe( webpack( server.config ) )
        .pipe( gulp.dest('./app/') )
});

gulp.task('bundle', ['bundle-client', 'bundle-server']);

@@ -55,15 +55,8 @@
 pack
--stream
 ');%0A
@@ -66,32 +66,24 @@
 r client
- = %7B%0A    c
+C
 onfig
-:
+ =
  require
@@ -121,68 +121,27 @@
 js')
-,%0A    in: './src/client/index.jsx'%0A%7D, server = %7B%0A    c
+%0Avar serverC
 onfig
-:
+ =
  req
@@ -183,44 +183,9 @@
 js')
-,%0A    in: './src/server/index.js'%0A%7D;
+%0A
 %0A%0Agu
@@ -222,59 +222,19 @@
 ion(
+done
 ) %7B%0A   
- return gulp.src( client.in )%0A        .pipe(
  web
@@ -249,55 +249,35 @@
 ient
-.c
+C
 onfig )
- )%0A        .pipe( gulp.dest('./app/') 
+.run(onBundle(done)
 )%0A%7D)
@@ -319,59 +319,19 @@
 ion(
+done
 ) %7B%0A   
- return gulp.src( server.in )%0A        .pipe(
  web
@@ -346,55 +346,35 @@
 rver
-.c
+C
 onfig )
- )%0A        .pipe( gulp.dest('./app/') 
+.run(onBundle(done)
 )%0A%7D)
@@ -433,8 +433,181 @@
 ver'%5D);%0A
+%0A%0Afunction onBundle(done) %7B%0A    return function(err, stats) %7B%0A        if (err) console.log('Error', err);%0A        else console.log(stats.toString());%0A        done()%0A    %7D%0A%7D%0A

Refactor gulp task to bundle front/backend