Permalink
Browse files

* add gulp task to minify json files.

  • Loading branch information...
1 parent b4d1757 commit 7cf983fa0d991a373eec123e707c9b29680fc500 @Catouse Catouse committed Sep 5, 2016
Showing with 16 additions and 1 deletion.
  1. +15 −1 gulpfile.js
  2. +1 −0 package.json
View
@@ -19,6 +19,7 @@ var extend = require('extend'),
format = require('string-format').extend(String.prototype),
colors = require('colors'),
gulp = require('gulp'),
+ jsonminify = require('gulp-jsonminify'),
zui = require('./zui.json'),
pkg = require('./package.json'),
showFileDetail = true;
@@ -440,7 +441,8 @@ gulp.task('build', function(callback) {
});
['dist', 'doc', 'theme', 'lib'].forEach(function(name) {
- gulp.task(name, function(callback) {
+ var depsTasks = (name == 'dist' || name == 'doc') ? ['minJSON'] : [];
+ gulp.task(name, depsTasks, function(callback) {
console.log(' BEGIN >> ' + (' Build ' + name.bold + ' ').inverse);
buildBundle(name == 'lib' ? 'seperate' : name, function() {
console.log(' END >> ' + (' Build ' + name.bold + ' completed. ').green.inverse);
@@ -471,6 +473,18 @@ gulp.task('build', function(callback) {
});
});
+gulp.task('minJSON', function(cb) {
+ gulp.src(['./docs/index.json', './docs/icons.json'])
+ .pipe(jsonminify())
+ .pipe(rename({suffix: '.min'}))
+ .pipe(gulp.dest('./docs/'));
+ gulp.src(['zui.json'])
+ .pipe(jsonminify())
+ .pipe(rename({suffix: '.min'}))
+ .pipe(gulp.dest('./docs/'));
+ cb();
+});
+
gulp.task('prettify:js', function() {
return gulp.src('./src/js/**/*')
.pipe(prettify({
View
@@ -45,6 +45,7 @@
"gulp-cssmin": "^0.1.7",
"gulp-header": "^1.7.1",
"gulp-jsbeautifier": "^1.0.1",
+ "gulp-jsonminify": "^1.0.0",
"gulp-less": "^3.0.3",
"gulp-param": "^0.6.4",
"gulp-rename": "^1.2.2",

0 comments on commit 7cf983f

Please sign in to comment.