blob: c732eab623a42d7717ca6c0911f8446c57bd39bb [file] [log] [blame]
/*eslint-env node */
/*global require: true, module: true */
'use strict';
var options = require('../gulp-options.js'), gulp = require('gulp'),
clean = require('gulp-clean'), webapp = require('./webapp.js'),
imagemin = require('gulp-imagemin');
var runSequence = require('run-sequence');
gulp.task('webapp', function(callback) {
return webapp(callback);
});
gulp.task('distribution:clean', function() {
return gulp.src([options.dirname + '/dist'], {'read': false}).pipe(clean({
'force': true
}));
});
gulp.task('distribution:copy', function() {
return gulp.src(['**/*'], {'cwd': options.targetFolderPath + '/webapp'})
.pipe(gulp.dest(options.dirname + '/dist'));
});
gulp.task(
'imagemin',
() => gulp.src([options.dirname + '/app/assets/images/*'])
.pipe(imagemin({
optimizationLevel: 3,
progressive: true,
interlaced: false,
svgoPlugins: [{removeViewBox: false}]
}))
.pipe(gulp.dest('dist/assets/images')));
module.exports = function(callback) {
return runSequence(
'distribution:clean', 'webapp', 'distribution:copy', 'imagemin',
callback);
};