Added gulp support.
Gulp allows for sanitization before publication. It is similar to make
but has more features.
Change-Id: Ib4cd5042a5af4b63de9d0a5004c2b0c62cb5ca1d
diff --git a/client/catalog-dev/js/autocomplete.js b/client/catalog-dev/js/autocomplete.js
index d6987e2..677e486 100644
--- a/client/catalog-dev/js/autocomplete.js
+++ b/client/catalog-dev/js/autocomplete.js
@@ -17,7 +17,11 @@
}
jQuery.fn.extend({
/**
- * @param {Array<String>|getSuggestions}
+ * This setups up the default autocomplete functionality on an object.
+ * Using either a list of options or supplying a function that returns them,
+ * auto complete will create a menu for users to navigate and select a
+ * valid option.
+ * @param {Array<String>|function(String, function(Array<String>))} suggestions
*/
autoComplete: function(suggestions) {
@@ -174,8 +178,3 @@
});
})();
-/**
- * @callback getSuggestions
- * @param {string} current - The current value of the input field.
- * @param {function}
- */
diff --git a/client/gulpfile.js b/client/gulpfile.js
index 53e2f10..cc79d11 100644
--- a/client/gulpfile.js
+++ b/client/gulpfile.js
@@ -1,6 +1,54 @@
var gulp = require('gulp');
+var minifyHTML = require('gulp-minify-html');
+var minifyCSS = require('gulp-minify-css');
+var sourcemaps = require('gulp-sourcemaps');
+var closure = require('gulp-closure-compiler-service');
+var clean = require('gulp-clean');
-gulp.task('default, function() {
+gulp.task('minify-html', function() {
+
+ return gulp.src(['./catalog-dev/index.html'])
+ .pipe(minifyHTML())
+ .pipe(gulp.dest('./catalog/'));
});
+gulp.task('minify-js', function() {
+
+ return gulp.src('./catalog-dev/js/*.js')
+ .pipe(sourcemaps.init())
+ .pipe(closure())
+ .pipe(sourcemaps.write('../../catalog-dev/js'))
+ .pipe(gulp.dest('./catalog/js'));
+
+});
+
+gulp.task('minify-css', function() {
+
+ return gulp.src(['./catalog-dev/css/style.css', './catalog-dev/css/cubeLoader.css'])
+ .pipe(sourcemaps.init())
+ .pipe(minifyCSS())
+ .pipe(sourcemaps.write('../../catalog-dev/css'))
+ .pipe(gulp.dest('./catalog/css'));
+
+});
+
+gulp.task('copy', function() {
+
+ gulp.src('./catalog-dev/config.json')
+ .pipe(gulp.dest('./catalog'));
+
+ gulp.src('./catalog-dev/css/*.min.css')
+ .pipe(gulp.dest('./catalog/css'));
+
+});
+
+gulp.task('clean', function(){
+
+ return gulp.src('./catalog', {read: false})
+ .pipe(clean());
+
+});
+
+gulp.task('default', ['minify-html', 'minify-css', 'minify-js', 'copy']);
+
diff --git a/client/package.json b/client/package.json
index f15889c..dd76077 100644
--- a/client/package.json
+++ b/client/package.json
@@ -15,6 +15,11 @@
},
"devDependencies": {
"gulp": "^3.9.0",
+ "gulp-clean": "^0.3.1",
+ "gulp-closure-compiler-service": "^0.5.0",
+ "gulp-minify-css": "^1.2.1",
+ "gulp-minify-html": "^1.0.4",
+ "gulp-sourcemaps": "^1.5.2",
"http-server": "^0.8.0"
}
}