mybuddy/gulpfile.js/tasks/compress.js

64 lines
1.6 KiB
JavaScript
Raw Normal View History

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;
gulp.task('compress', [
'compress:scripts:app',
'compress:styles:app',
'compress:scripts:vendor',
'compress:styles:vendor',
'compress:scripts:graph'
]);
gulp.task('compress:scripts:app', ['scripts:app'], function (cb) {
pump([
2017-08-21 20:03:16 +00:00
gulp.src(basePath + 'js/app.js'),
concat('app.min.js'),
uglify(),
2017-08-21 20:03:16 +00:00
gulp.dest(compressConfig.scripts.dest)
], 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'),
concat('vendor.min.js'),
uglify(),
2017-08-21 20:03:16 +00:00
gulp.dest(compressConfig.scripts.dest)
], cb);
});
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);
});
gulp.task('compress:styles:app', ['styles:app'], function (cb) {
pump([
2017-08-21 20:03:16 +00:00
gulp.src(basePath + 'css/app.css'),
concat('app.min.css'),
csso(),
2017-08-21 20:03:16 +00:00
gulp.dest(compressConfig.styles.dest)
], 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'),
concat('vendor.min.css'),
csso(),
2017-08-21 20:03:16 +00:00
gulp.dest(compressConfig.styles.dest)
], cb);
});