const gulp = require('gulp');
const gulp_if = require('gulp-if');
const sourcemaps = require('gulp-sourcemaps');
const uglify = require('gulp-uglify');

const del = require('del');
const path = require('path');

const env = require('gulp/env');

const vendors_output_dir = path.join(env.assetsOutputBaseDir, 'js', 'vendors');

// JQuery
gulp.task('jquery', () => {
	const jquery_source = path.resolve(path.join(
		'node_modules',
		'jquery',
		'dist',
		'jquery.js'
	));
	return gulp.src(jquery_source)
		.pipe(sourcemaps.init({loadMaps: true}))
		.pipe(uglify())
		.pipe(gulp_if(env.isDevelopment, sourcemaps.write()))
		.pipe(gulp.dest(vendors_output_dir));
});

// Foundation
gulp.task('foundation', () => {
	const foundation_source = path.resolve(path.join(
		'node_modules',
		'foundation-sites',
		'dist',
		'foundation.js'
	));
	return gulp.src(foundation_source)
		.pipe(sourcemaps.init({loadMaps: true}))
		.pipe(uglify())
		.pipe(gulp_if(env.isDevelopment, sourcemaps.write()))
		.pipe(gulp.dest(vendors_output_dir));
});

gulp
	.task('vendors-clean', () => del(path.join(vendors_output_dir, '*/**.js')))
	.task('vendors', ['jquery', 'foundation']);

module.exports = {
	build: 'vendors',
	clean: 'vendors-clean'
};

@@ -55,24 +55,63 @@
 'gulp-if');%0A
+const concat = require('gulp-concat');%0A
 const source
@@ -578,32 +578,59 @@
 true%7D))%0A%09%09.pipe(
+gulp_if(env.isDevelopment, 
 uglify())%0A%09%09.pip
@@ -614,32 +614,33 @@
 pment, uglify())
+)
 %0A%09%09.pipe(gulp_if
@@ -791,24 +791,28 @@
 ation_source
+_dir
  = path.reso
@@ -883,28 +883,313 @@
 %0A%09%09'
-foundation
+plugins'%0A%09));%0A%09const foundation_source_files = %5B%0A%09%09'foundation.core
 .js'
+,
 %0A%09
+%09'foundation.util.triggers.js',%0A%09%09'foundation.util.mediaQuery.js',%0A%09%09'foundation.responsiveMenu.js',%0A%09%09'foundation.responsiveToggle.js',%0A%09%09'foundation.sticky.js'%0A%09%5D.map((component) =%3E path.join(foundation_source_dir, component
 ));%0A
+%0A
 %09ret
@@ -1214,24 +1214,30 @@
 ation_source
+_files
 )%0A%09%09.pipe(so
@@ -1277,23 +1277,38 @@
 %09%09.pipe(
-uglify(
+concat('foundation.js'
 ))%0A%09%09.pi
@@ -1350,32 +1350,77 @@
 emaps.write()))%0A
+%09%09.pipe(gulp_if(env.isProduction, uglify()))%0A
 %09%09.pipe(gulp.des

fix foundation build