Making minify vendor a separate task in gulp

Change-Id: I389e2d1184e500473d8d3eb283c4e088fb79d2a1
Signed-off-by: Iftekharul Islam <iislam@us.ibm.com>
diff --git a/README.md b/README.md
index 8401135..d507ef4 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,9 @@
 ## Installation
 `npm install`
 
+## Minify vendors
+`npm run-script minifyvendors`
+
 ## Distribution
 `npm run-script distribution`
 
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index 0c69b9e..d177366 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -337,7 +337,7 @@
                           severityFlags[priority.toLowerCase()] = true;
                           relatedItems = [];
                           content.data[key].associations.forEach(function(item){
-                            relatedItems.push(item[2]); //@TODO: better way to find the third item?
+                            relatedItems.push(item[2]);
                           });
 
                           data.push(Object.assign({
diff --git a/gulp_tasks/minifyvendors.js b/gulp_tasks/minifyvendors.js
new file mode 100644
index 0000000..38a17ce
--- /dev/null
+++ b/gulp_tasks/minifyvendors.js
@@ -0,0 +1,42 @@
+
+/*eslint-env node */
+/*global require: true, module: true */
+
+'use strict';
+
+var options = require('../gulp-options.js'),
+    gulp = require('gulp'),
+
+    // Base dependencies
+    clean = require('gulp-clean'),
+    rename = require('gulp-rename'),
+
+    // Classical gulp dependencies
+    uglify = require('gulp-uglify');
+
+var runSequence = require('run-sequence');
+
+gulp.task('minifyvendorjs:clean', function () {
+  return gulp.src(options.bowerFolderPath + '/**/*.min.js', {read: false})
+    .pipe(clean());
+});
+
+gulp.task('minifyvendorjs:minify', function () {
+    return gulp
+        .src(options.bowerFolderPath + '/**/*.js')
+        .pipe(uglify({
+            preserveComments: 'false'
+        })) 
+        .pipe(rename({suffix: '.min'}))
+        .pipe(gulp.dest(function(file) {
+            return file.base;
+        }))
+});
+
+module.exports = function (callback) {
+    return runSequence(
+    	'minifyvendorjs:clean',
+        'minifyvendorjs:minify',
+        callback
+    );
+};
\ No newline at end of file
diff --git a/gulp_tasks/webapp.js b/gulp_tasks/webapp.js
index 6a8b99e..e514543 100644
--- a/gulp_tasks/webapp.js
+++ b/gulp_tasks/webapp.js
@@ -45,18 +45,6 @@
         .pipe(gulp.dest(options.srcFolderPath + '/styles'))
 });
 
-gulp.task('webapp:minifyvendorjs', function () {
-    return gulp
-        .src(options.bowerFolderPath + '/**/*.js')
-        .pipe(uglify({
-            preserveComments: 'false'
-        })) 
-        .pipe(rename({suffix: '.min'}))
-        .pipe(gulp.dest(function(file) {
-            return file.base;
-        }))
-});
-
 // ----- To .temp from app
 gulp.task('webapp:copyjs', function () {
     return gulp.src(options.srcFolderPath + '/**/*.js')
@@ -123,7 +111,6 @@
     return runSequence(
         'webapp:clean',
         'webapp:sasscompile',
-        'webapp:minifyvendorjs',
         [
             'webapp:copyjs',
             'webapp:copycss',
diff --git a/package.json b/package.json
index dd2a5bd..190374b 100644
--- a/package.json
+++ b/package.json
@@ -7,6 +7,7 @@
     "bower": "node node_modules/bower/bin/bower",
     "gulp": "node node_modules/gulp/bin/gulp.js",
     "distribution": "npm run gulp distribution",
+    "minifyvendors": "npm run gulp minifyvendors",
     "serve": "npm run gulp server",
     "shrinkwrap": "npm shrinkwrap --dev",
     "start-dev": "npm run gulp server",