text: const gulp = require("gulp");
  const del = require('del');
  const babel = require("gulp-babel");
  const uglify = require('gulp-uglify');
  const concat = require('gulp-concat');
  const merge = require('merge-stream');
  const rename = require("gulp-rename");
  var sass = require('gulp-dart-sass');
  const imagemin = require('gulp-imagemin');
  
  const configuration = {
  	paths: {
  		src: {
  			fonts: './frontend-src/webfonts/*.+(eot|svg|ttf|woff|woff2)',
  			img: './frontend-src/img/*.+(png|jpg|gif)',
  			scss: "./frontend-src/scss/**/*.scss",
  			js: "./frontend-src/js/*.js",
  
  		},
  		dist: {
  			scss: "./assets/css",
  			js: "./assets/js",
  			img: "./assets/img",
  			fonts: "./assets/webfonts",
  
  		},
  	},
  	files_to_concatenate: [
  		{
  			bundle_name: 'customer.vendor.min.js',
  			src: [
  				"./frontend-src/js/vendor/jquery/jquery.min.js",
  				"./frontend-src/js/vendor/bootstrap/bootstrap.bundle.min.js",
  				"./frontend-src/js/vendor/select2/select2.min.js",
  				"./frontend-src/js/vendor/cleave/cleave.min.js",
  				"./frontend-src/js/vendor/cleave/cleave-phone.mx.js",
  				"./frontend-src/js/vendor/jquery-validation/jquery.validate.min.js",
  				"./frontend-src/js/vendor/jquery-input-filter/jquery-input-filter.js",
  				"./frontend-src/js/common/super-fresco.js",
  			]
  		},
  		{
  			bundle_name: 'customers.vendor.min.js',
  			src: [
  				"./frontend-src/js/vendor/jquery/jquery.min.js",
  				"./frontend-src/js/vendor/bootstrap/bootstrap.bundle.min.js",
  				"./frontend-src/js/vendor/datatables/jquery.dataTables.min.js",
  				"./frontend-src/js/vendor/datatables/dataTables.bootstrap4.min.js",
  				"./frontend-src/js/vendor/datatables/dataTables.responsive.min.js",
  				"./frontend-src/js/vendor/datatables/responsive.bootstrap4.min.js",
  				"./frontend-src/js/vendor/datatables/Spanish.js",
  				"./frontend-src/js/vendor/sweetalert2/sweetalert2.all.min.js",
  				"./frontend-src/js/common/super-fresco.js",
  			]
  		},
  		{
  			bundle_name: 'document.vendor.min.js',
  			src: [
  				"./frontend-src/js/vendor/handlebars/handlebars.min.js",
  				"./frontend-src/js/vendor/pikaday/custom-pikaday.js",
  				"./frontend-src/js/vendor/pikaday/spanish.js",
  				"./frontend-src/js/vendor/jquery/jquery.min.js",
  				"./frontend-src/js/vendor/bootstrap/bootstrap.bundle.min.js",
  				"./frontend-src/js/vendor/typeahead/typeahead.bundle.min.js",
  				"./frontend-src/js/vendor/select2/select2.min.js",
  				"./frontend-src/js/vendor/autosize/autosize.min.js",
  				"./frontend-src/js/vendor/jquery-validation/jquery.validate.min.js",
  				"./frontend-src/js/vendor/jquery-input-filter/jquery-input-filter.js",
  				"./frontend-src/js/vendor/sweetalert2/sweetalert2.all.min.js",
  				"./frontend-src/js/common/super-fresco.js",
  			]
  		},
  		{
  			bundle_name: 'empty.vendor.min.js',
  			src: [
  				"./frontend-src/js/vendor/jquery/jquery.min.js",
  				"./frontend-src/js/vendor/bootstrap/bootstrap.bundle.min.js",
  				"./frontend-src/js/common/super-fresco.js",
  			]
  		},
  		{
  			bundle_name: 'estimates.vendor.min.js',
  			src: [
  
  				"./frontend-src/js/vendor/jquery/jquery.min.js",
  				"./frontend-src/js/vendor/bootstrap/bootstrap.bundle.min.js",
  				"./frontend-src/js/vendor/datatables/jquery.dataTables.min.js",
  				"./frontend-src/js/vendor/datatables/dataTables.bootstrap4.min.js",
  				"./frontend-src/js/vendor/datatables/dataTables.responsive.min.js",
  				"./frontend-src/js/vendor/datatables/responsive.bootstrap4.min.js",
  				"./frontend-src/js/vendor/datatables/Spanish.js",
  				"./frontend-src/js/vendor/sweetalert2/sweetalert2.all.min.js",
  				"./frontend-src/js/common/super-fresco.js",
  
  			]
  		},
  		{
  			bundle_name: 'login.vendor.min.js',
  			src: [
  				"./frontend-src/js/vendor/jquery/jquery.min.js",
  				"./frontend-src/js/vendor/bootstrap/bootstrap.bundle.min.js",
  				"./frontend-src/js/vendor/jquery-validation/jquery.validate.min.js",
  				"./frontend-src/js/common/super-fresco.js",
  			]
  		},
  		{
  			bundle_name: 'orders.vendor.min.js',
  			src: [
  				"./frontend-src/js/vendor/jquery/jquery.min.js",
  				"./frontend-src/js/vendor/bootstrap/bootstrap.bundle.min.js",
  				"./frontend-src/js/vendor/datatables/jquery.dataTables.min.js",
  				"./frontend-src/js/vendor/datatables/dataTables.bootstrap4.min.js",
  				"./frontend-src/js/vendor/datatables/dataTables.responsive.min.js",
  				"./frontend-src/js/vendor/datatables/responsive.bootstrap4.min.js",
  				"./frontend-src/js/vendor/datatables/Spanish.js",
  				"./frontend-src/js/vendor/sweetalert2/sweetalert2.all.min.js",
  				"./frontend-src/js/common/super-fresco.js",
  			]
  		},
  		{
  			bundle_name: 'product.vendor.min.js',
  			src: [
  				"./frontend-src/js/vendor/jquery/jquery.min.js",
  				"./frontend-src/js/vendor/bootstrap/bootstrap.bundle.min.js",
  				"./frontend-src/js/vendor/cleave/cleave.min.js",
  				"./frontend-src/js/vendor/jquery-validation/jquery.validate.min.js",
  				"./frontend-src/js/vendor/jquery-input-filter/jquery-input-filter.js",
  				"./frontend-src/js/common/super-fresco.js",
  			]
  		},
  		{
  			bundle_name: 'products.vendor.min.js',
  			src: [
  
  				"./frontend-src/js/vendor/jquery/jquery.min.js",
  				"./frontend-src/js/vendor/bootstrap/bootstrap.bundle.min.js",
  				"./frontend-src/js/vendor/datatables/jquery.dataTables.min.js",
  				"./frontend-src/js/vendor/datatables/dataTables.bootstrap4.min.js",
  				"./frontend-src/js/vendor/datatables/dataTables.responsive.min.js",
  				"./frontend-src/js/vendor/datatables/responsive.bootstrap4.min.js",
  				"./frontend-src/js/vendor/datatables/Spanish.js",
  				"./frontend-src/js/vendor/sweetalert2/sweetalert2.all.min.js",
  				"./frontend-src/js/common/super-fresco.js",
  			]
  		},
  		{
  			bundle_name: 'user.vendor.min.js',
  			src: [
  
  				"./frontend-src/js/vendor/jquery/jquery.min.js",
  				"./frontend-src/js/vendor/bootstrap/bootstrap.bundle.min.js",
  				"./frontend-src/js/vendor/croppie/croppie.min.js",
  				"./frontend-src/js/vendor/cleave/cleave.min.js",
  				"./frontend-src/js/vendor/jquery-validation/jquery.validate.min.js",
  				"./frontend-src/js/vendor/jquery-input-filter/jquery-input-filter.js",
  				"./frontend-src/js/common/super-fresco.js",
  			]
  		},
  		{
  			bundle_name: 'users.vendor.min.js',
  			src: [
  				"./frontend-src/js/vendor/jquery/jquery.min.js",
  				"./frontend-src/js/vendor/bootstrap/bootstrap.bundle.min.js",
  				"./frontend-src/js/vendor/datatables/jquery.dataTables.min.js",
  				"./frontend-src/js/vendor/datatables/dataTables.bootstrap4.min.js",
  				"./frontend-src/js/vendor/datatables/dataTables.responsive.min.js",
  				"./frontend-src/js/vendor/datatables/responsive.bootstrap4.min.js",
  				"./frontend-src/js/vendor/datatables/Spanish.js",
  				"./frontend-src/js/vendor/sweetalert2/sweetalert2.all.min.js",
  				"./frontend-src/js/common/super-fresco.js",
  			]
  		},
  		{
  			bundle_name: 'settings.vendor.min.js',
  			src: [
  
  				"./frontend-src/js/vendor/jquery/jquery.min.js",
  				"./frontend-src/js/vendor/bootstrap/bootstrap.bundle.min.js",
  				"./frontend-src/js/vendor/croppie/croppie.min.js",
  				"./frontend-src/js/vendor/jquery-validation/jquery.validate.min.js",
  				"./frontend-src/js/common/super-fresco.js",
  				"./frontend-src/js/vendor/sweetalert2/sweetalert2.all.min.js",
  			]
  		},
  
  
  	]
  };
  
  function clean() {
  	return del('assets/', {force: true});
  }
  
  function fonts() {
  	return gulp
  		.src(configuration.paths.src.fonts)
  		.pipe(gulp.dest(configuration.paths.dist.fonts))
  }
  
  function bundles() {
  	return merge(
  		configuration.files_to_concatenate.map(function (currentValue, index) {
  			return gulp.src(currentValue.src)
  				.pipe(concat(currentValue.bundle_name))
  				.pipe(uglify())
  				.pipe(gulp.dest(configuration.paths.dist.js))
  		})
  	);
  }
  
  function dev_img() {
  	return gulp
  		.src(configuration.paths.src.img)
  		.pipe(gulp.dest(configuration.paths.dist.img))
  }
  
  function prod_img() {
  	return gulp.src(configuration.paths.src.img)
  		.pipe(imagemin())
  		.pipe(gulp.dest(configuration.paths.dist.img))
  }
  
  function dev_js() {
  	return gulp
  		.src(configuration.paths.src.js)
  		.pipe(
  			babel({
  				presets: ["@babel/env"],
  			})
  		)
  		.pipe(rename({suffix: '.min'}))
  		.pipe(gulp.dest(configuration.paths.dist.js))
  }
  
  function prod_js() {
  	return gulp
  		.src(configuration.paths.src.js)
  		.pipe(
  			babel({
  				presets: ["@babel/env"],
  			})
  		)
  		.pipe(uglify())
  		.pipe(rename({suffix: '.min'}))
  		.pipe(gulp.dest(configuration.paths.dist.js))
  }
  
  function dev_scss() {
  	return gulp
  		.src(configuration.paths.src.scss)
  		.pipe(sass().on('error', sass.logError))
  		.pipe(rename({suffix: '.min'}))
  		.pipe(gulp.dest(configuration.paths.dist.scss))
  }
  
  function prod_scss() {
  	return gulp
  		.src(configuration.paths.src.scss)
  		.pipe(sass({
  			outputStyle: "compressed"
  		}).on('error', sass.logError))
  		.pipe(rename({suffix: '.min'}))
  		.pipe(gulp.dest(configuration.paths.dist.scss));
  }
  
  function watch() {
  	gulp.watch(configuration.paths.src.js, dev_js);
  	gulp.watch(configuration.paths.src.scss, dev_scss);
  	gulp.watch(configuration.paths.src.img, dev_img);
  }
  
  exports.bundles = bundles;
  
  exports.prod = gulp.series(clean, fonts, prod_img, prod_scss, prod_js, bundles);
  exports.default = gulp.series(fonts, dev_img, dev_scss, dev_js, watch);
  