'use strict';
/**
* @module tasks/css/minify
*/
/**
* taskFactory
* @param sources {Array} glob
* @param destinations {Array} glob
* @returns task {Function}
*/
module.exports = function taskFactory(sources, options) {
return function task() {
var gulp = require('gulp');
var cleanCss = require('gulp-clean-css');
var combiner = require('stream-combiner2');
var destinationsHelper = require('../helpers/build-destinations');
var destination;
if (options && options.destination) {
destination = options.destination;
}
var minify = combiner.obj([
gulp.src(sources),
cleanCss(),
gulp.dest(function (file) {
return destinationsHelper.getDestination(file.base, destination);
})
]);
minify.on('error', console.error.bind(console));
return minify;
};
};