2018-11-01 11:37:32 +01:00
|
|
|
const { series, src, watch, dest, parallel, task} = require('gulp');
|
|
|
|
|
const del = require('promised-del');
|
2018-10-29 15:46:38 +01:00
|
|
|
const uglify = require('gulp-uglify');
|
|
|
|
|
const concat = require('gulp-concat');
|
2015-01-20 10:23:05 +01:00
|
|
|
|
|
|
|
|
var paths = {
|
|
|
|
|
minified: 'contao-leaflet.js',
|
2018-11-01 11:37:32 +01:00
|
|
|
scripts: ['js/vendor/*.js', 'js/*.js'],
|
2017-10-11 15:24:20 +02:00
|
|
|
dest: 'src/Bundle/Resources/public/js'
|
2015-01-20 10:23:05 +01:00
|
|
|
};
|
|
|
|
|
|
2018-11-01 11:37:32 +01:00
|
|
|
function clean () {
|
|
|
|
|
return del([paths.dest + '/' + paths.minified]);
|
2018-10-29 15:46:38 +01:00
|
|
|
}
|
2015-01-20 10:23:05 +01:00
|
|
|
|
2018-11-01 11:37:32 +01:00
|
|
|
function build () {
|
2018-10-29 15:46:38 +01:00
|
|
|
return src(paths.scripts)
|
2015-01-20 10:23:05 +01:00
|
|
|
.pipe(concat(paths.minified))
|
|
|
|
|
.pipe(uglify())
|
2018-10-29 15:46:38 +01:00
|
|
|
.pipe(dest(paths.dest));
|
2018-11-01 11:37:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const buildTasks = series(clean, build);
|
2015-01-22 16:09:27 +01:00
|
|
|
|
2018-11-01 10:25:54 +01:00
|
|
|
function watchTask () {
|
|
|
|
|
watch(
|
|
|
|
|
paths.scripts,
|
2018-11-01 11:37:32 +01:00
|
|
|
buildTasks
|
2018-11-01 10:25:54 +01:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-01 11:37:32 +01:00
|
|
|
exports.clean = clean;
|
2018-11-01 10:25:54 +01:00
|
|
|
exports.watch = watchTask;
|
2018-11-01 11:37:32 +01:00
|
|
|
exports.build = buildTasks;
|
|
|
|
|
exports.default = buildTasks;
|