2017-08-21 19:42:32 +00:00
|
|
|
var gulp = require('gulp');
|
|
|
|
|
|
|
|
var concat = require('gulp-concat');
|
|
|
|
var csso = require('gulp-csso');
|
|
|
|
var pump = require('pump');
|
|
|
|
var uglify = require('gulp-uglify');
|
|
|
|
|
2017-08-21 20:03:16 +00:00
|
|
|
var basePath = require('../config.js').basePath;
|
|
|
|
var compressConfig = require('../config.js').compressConfig;
|
|
|
|
|
2017-08-21 19:42:32 +00:00
|
|
|
|
|
|
|
gulp.task('compress', [
|
|
|
|
'compress:scripts:app',
|
|
|
|
'compress:styles:app',
|
|
|
|
'compress:scripts:vendor',
|
2017-08-24 13:48:38 +00:00
|
|
|
'compress:styles:vendor',
|
|
|
|
'compress:scripts:graph'
|
2017-08-21 19:42:32 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
gulp.task('compress:scripts:app', ['scripts:app'], function (cb) {
|
|
|
|
pump([
|
2017-08-21 20:03:16 +00:00
|
|
|
gulp.src(basePath + 'js/app.js'),
|
2017-08-21 19:42:32 +00:00
|
|
|
concat('app.min.js'),
|
|
|
|
uglify(),
|
2017-08-21 20:03:16 +00:00
|
|
|
gulp.dest(compressConfig.scripts.dest)
|
2017-08-21 19:42:32 +00:00
|
|
|
], cb);
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task('compress:scripts:vendor', ['scripts:vendor'], function (cb) {
|
|
|
|
pump([
|
2017-08-21 20:03:16 +00:00
|
|
|
gulp.src(basePath + 'js/vendor.js'),
|
2017-08-21 19:42:32 +00:00
|
|
|
concat('vendor.min.js'),
|
|
|
|
uglify(),
|
2017-08-21 20:03:16 +00:00
|
|
|
gulp.dest(compressConfig.scripts.dest)
|
2017-08-21 19:42:32 +00:00
|
|
|
], cb);
|
|
|
|
});
|
|
|
|
|
2017-08-24 13:48:38 +00:00
|
|
|
gulp.task('compress:scripts:graph', ['scripts:graph'], function (cb) {
|
|
|
|
pump([
|
|
|
|
gulp.src(basePath + 'js/graph.js'),
|
|
|
|
concat('graph.min.js'),
|
|
|
|
uglify(),
|
|
|
|
gulp.dest(compressConfig.scripts.dest)
|
|
|
|
], cb);
|
|
|
|
});
|
|
|
|
|
2017-08-21 19:42:32 +00:00
|
|
|
gulp.task('compress:styles:app', ['styles:app'], function (cb) {
|
|
|
|
pump([
|
2017-08-21 20:03:16 +00:00
|
|
|
gulp.src(basePath + 'css/app.css'),
|
2017-08-21 19:42:32 +00:00
|
|
|
concat('app.min.css'),
|
|
|
|
csso(),
|
2017-08-21 20:03:16 +00:00
|
|
|
gulp.dest(compressConfig.styles.dest)
|
2017-08-21 19:42:32 +00:00
|
|
|
], cb);
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task('compress:styles:vendor', ['styles:vendor'], function (cb) {
|
|
|
|
pump([
|
2017-08-21 20:03:16 +00:00
|
|
|
gulp.src(basePath + 'css/vendor.css'),
|
2017-08-21 19:42:32 +00:00
|
|
|
concat('vendor.min.css'),
|
|
|
|
csso(),
|
2017-08-21 20:03:16 +00:00
|
|
|
gulp.dest(compressConfig.styles.dest)
|
2017-08-21 19:42:32 +00:00
|
|
|
], cb);
|
|
|
|
});
|