blob: c732eab623a42d7717ca6c0911f8446c57bd39bb [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
Andrew Geissler7d6e6292018-05-24 12:06:58 -07006var options = require('../gulp-options.js'), gulp = require('gulp'),
7 clean = require('gulp-clean'), webapp = require('./webapp.js'),
Iftekharul Islam99d199f2017-03-24 15:28:25 -05008 imagemin = require('gulp-imagemin');
9
10var runSequence = require('run-sequence');
11
Andrew Geissler7d6e6292018-05-24 12:06:58 -070012gulp.task('webapp', function(callback) {
13 return webapp(callback);
Iftekharul Islam99d199f2017-03-24 15:28:25 -050014});
15
Andrew Geissler7d6e6292018-05-24 12:06:58 -070016gulp.task('distribution:clean', function() {
17 return gulp.src([options.dirname + '/dist'], {'read': false}).pipe(clean({
18 'force': true
19 }));
Iftekharul Islam99d199f2017-03-24 15:28:25 -050020});
21
Andrew Geissler7d6e6292018-05-24 12:06:58 -070022gulp.task('distribution:copy', function() {
23 return gulp.src(['**/*'], {'cwd': options.targetFolderPath + '/webapp'})
24 .pipe(gulp.dest(options.dirname + '/dist'));
Iftekharul Islam99d199f2017-03-24 15:28:25 -050025});
26
Andrew Geissler7d6e6292018-05-24 12:06:58 -070027gulp.task(
28 'imagemin',
29 () => gulp.src([options.dirname + '/app/assets/images/*'])
30 .pipe(imagemin({
31 optimizationLevel: 3,
32 progressive: true,
33 interlaced: false,
34 svgoPlugins: [{removeViewBox: false}]
35 }))
36 .pipe(gulp.dest('dist/assets/images')));
Iftekharul Islam99d199f2017-03-24 15:28:25 -050037
Andrew Geissler7d6e6292018-05-24 12:06:58 -070038module.exports = function(callback) {
39 return runSequence(
40 'distribution:clean', 'webapp', 'distribution:copy', 'imagemin',
41 callback);
Iftekharul Islam99d199f2017-03-24 15:28:25 -050042};