HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/Velosophe/carparkcannonball.cc/wwwroot/gulp/helper-tasks/scripts.js
// Load required plugins
var merge       = require('merge-stream');
var lazypipe    = require('lazypipe');

// Gulp Scripts task
// `gulp scripts` - Runs JSHint then compiles, combines, and optimizes Bower JS and project JS.
module.exports = function ($, gulp, manifest, settings) {
    return function () {

        var path        = manifest.paths;
        var config      = manifest.config || {};
        var globs       = manifest.globs;
        var project     = manifest.getProjectGlobs();

        // Load main helper functions
        var helpers     = require('../functions/functions');

        // Merge all JS dependencies
        var merged = merge();
        manifest.forEachDependency('js', function(dep) {
            merged.add(
                gulp.src(dep.globs, {base: 'scripts'})

                // Run scripts lazypipe tasks
                .pipe(jsTasks(dep.name, settings, $, config))
            );
        });

        // Return and write to manifest
        return merged
            .pipe(helpers.writeToManifest('scripts', settings ));

    };
};

// JS processing pipeline
var jsTasks = function(filename, settings, $, config) {
    return lazypipe()

    // Init source maps
    // Only if NOT --production flag
    .pipe(function() {
        return $.if(settings.maps, $.sourcemaps.init());
    })

    // Concat files
    .pipe($.concat, filename)

    // Uglify JS
    // Only with --production flag
    .pipe(function() {
        return $.if(settings.uglify, $.uglify() );
    })

    // Remove console and debug messages
    // Only with --production flag
    .pipe(function() {
        return $.if(settings.failJshint, $.stripDebug() );
    })

    // Add revision numbering if --production flag is set
    .pipe(function() {
        return $.if(settings.rev, $.rev());
    })

    // Write source maps
    // Only if NOT --production flag
    .pipe(function() {
        return $.if(settings.maps, $.sourcemaps.write('.'));
    })();
};