blob: ec5aac05fadf938907345277af593f1e1a2501a3 [file] [log] [blame]
Iftekharul Islam99d199f2017-03-24 15:28:25 -05001/*eslint-env node */
2/*global require: true, module: true */
3
4'use strict';
5
6var options = require('../gulp-options.js'),
7 gulp = require('gulp'),
8 clean = require('gulp-clean'),
9 webapp = require('./webapp.js'),
10 imagemin = require('gulp-imagemin');
11
12var runSequence = require('run-sequence');
13
14gulp.task('webapp', function (callback) {
15 return webapp(callback);
16});
17
18gulp.task('distribution:clean', function () {
19 return gulp
20 .src([options.dirname + '/dist'], { 'read': false })
21 .pipe(clean({'force': true}));
22});
23
24gulp.task('distribution:copy', function () {
25 return gulp
26 .src(['**/*'], { 'cwd': options.targetFolderPath + '/webapp' })
27 .pipe(gulp.dest(options.dirname + '/dist'));
28});
29
30gulp.task('imagemin', () =>
31 gulp.src([options.dirname + '/app/assets/images/*'])
32 .pipe(imagemin({
33 optimizationLevel: 3,
34 progressive: true,
35 interlaced: false,
36 svgoPlugins: [{
37 removeViewBox: false
38 }]
39 }))
40 .pipe(gulp.dest('dist/assets/images'))
41);
42
43module.exports = function (callback) {
44 return runSequence('distribution:clean', 'webapp', 'distribution:copy', 'imagemin', callback);
45};