Git Product home page Git Product logo

gulp-minify's Introduction

gulp-minify

Minify JavaScript with terser.

Build Status NPM version

Note

The latest version of gulp-minify is using terser to minify files, this may cause some incompatible issues with earlier language versions for now, see #27.

So gulp-minify@es5 is for the earlier language versions if your project is not ready for the ECMAScript 6 yet.

Installation

Install package with NPM and add it to your development dependencies:

npm install --save-dev gulp-minify

Usage

Basic usage: the following minifies every *.js and *.mjs files to *-min.js and *-min.mjs respectively. Note that the original files are preserved.

const minify = require('gulp-minify');

gulp.task('compress', function() {
  gulp.src(['lib/*.js', 'lib/*.mjs'])
    .pipe(minify())
    .pipe(gulp.dest('dist'))
});

Options can be added to control more finely what's happening, for example:

const minify = require('gulp-minify');

gulp.task('compress', function() {
  gulp.src('lib/*.js')
    .pipe(minify({
        ext:{
            src:'-debug.js',
            min:'.js'
        },
        exclude: ['tasks'],
        ignoreFiles: ['.combo.js', '-min.js']
    }))
    .pipe(gulp.dest('dist'))
});

Options

  • ext An object that specifies output src and minified file extensions.

    • src

      The suffix string of the filenames that output source files ends with.

    • min

      • When string: The suffix string of the filenames that output minified files ends with.
      • When Array: The regex expressions to be replaced with input filenames. For example: [/\.(.*)-source\.js$/, '$1.js']
  • exclude

    Will not minify files in the dirs.

  • noSource Will not output the source code in the dest dirs.

  • ignoreFiles

    Will not minify files which matches the pattern.

  • mangle

    Pass false to skip mangling names.

  • output

    Pass an object if you wish to specify additional output options. The defaults are optimized for best compression.

  • compress

    Pass an object to specify custom compressor options. Pass false to skip compression completely.

  • preserveComments

    A convenience option for options.output.comments. Defaults to preserving no comments.

    • all

      Preserve all comments in code blocks

    • some

      Preserve comments that start with a bang (!) or include a Closure Compiler directive (@preserve, @license, @cc_on)

    • function

      Specify your own comment preservation function. You will be passed the current node and the current comment and are expected to return either true or false.

gulp-minify's People

Contributors

bbosman avatar derhecht avatar dev4s avatar deyhle avatar frederickjeanguerin avatar guilhermemar avatar hitkodev avatar hustxiaoc avatar jam155 avatar jbinard avatar kent-remi avatar nedex avatar rbayliss avatar yuanyuanlife avatar zbennett10 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gulp-minify's Issues

Unexpected token u in JSON at position 0

I need to deploy an application with gulpfile on production but one error persist and I don't understand your logs:

$ gulp clean-build-app-prod && npm start

error output below:

[04:58:40] Using gulpfile ~/projects/website/gulpfile.js
[04:58:40] Starting 'clean-prod'...
[04:58:40] Finished 'clean-prod' after 6.01 ms
[04:58:40] Starting 'clean-build-app-prod'...
[04:58:41] gulp-debug: app/app.js
[04:58:41] gulp-debug: app/appRoutes.js
[04:58:41] gulp-debug: app/js/controllers/MainCtrl.js
[04:58:41] gulp-debug: app/js/controllers/NavbarCtrl.js
[04:58:41] gulp-debug: app/js/controllers/PanelCtrl.js
[04:58:41] gulp-debug: app/js/controllers/UserCtrl.js
[04:58:41] gulp-debug: app/js/services/Page.js
[04:58:41] gulp-debug: app/js/services/SessionSrv.js
[04:58:41] gulp-debug: app/js/services/UserService.js
[04:58:41] gulp-debug: app/js/services/sessionInterceptor.js
[04:58:41] gulp-debug: 10 items
undefined:1
undefined
^

SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at Transform.minify [as _transform] (/home/paneladm/projects/website/node_modules/gulp-minify/index.js:127:33)
    at Transform._read (/home/paneladm/projects/website/node_modules/gulp-minify/node_modules/readable-stream/lib/_stream_transform.js:184:10)
    at Transform._write (/home/paneladm/projects/website/node_modules/gulp-minify/node_modules/readable-stream/lib/_stream_transform.js:172:12)
    at doWrite (/home/paneladm/projects/website/node_modules/gulp-minify/node_modules/readable-stream/lib/_stream_writable.js:237:10)
    at writeOrBuffer (/home/paneladm/projects/website/node_modules/gulp-minify/node_modules/readable-stream/lib/_stream_writable.js:227:5)
    at Transform.Writable.write (/home/paneladm/projects/website/node_modules/gulp-minify/node_modules/readable-stream/lib/_stream_writable.js:194:11)
    at DestroyableTransform.ondata (/home/paneladm/projects/website/node_modules/readable-stream/lib/_stream_readable.js:541:20)
    at emitOne (events.js:96:13)
    at DestroyableTransform.emit (events.js:191:7)

Why is there no source code?

I came here from npmjs.org looking for the gulp-minify source code, but this repo is just a readme. Why is that the case?

Unexpected character '`'

Got this error if I use the character '`' for template literals.

e.g. console.log(`Hello ${name}`)

Cannot read property 'replace' of undefined (line: undefined, col: undefined, pos: undefined

Getting the following error when trying to use gulp-minify in the following task. If I comment out the .pipe(minify({})) section the task works fine.

function copy() {
    return src([sdk_min_path, path +  js_filename, path +  mock_js_filename])
        .pipe(concat(js_filename))
        .pipe(minify({
            ext: {
                min: '.min.js'
            }
        }))
        .pipe(dest(dist_path))
}

Cannot read property 'replace' of undefined (line: undefined, col: undefined, pos: undefined
Details:
domainEmitter: [object Object]
domainThrown: false

Here's my npm list for gulp-minify:

├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected] deduped
│ │ ├─┬ [email protected]
│ │ │ └── [email protected] deduped
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected] deduped
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ └─┬ [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected] deduped
│ │ ├── [email protected] deduped
│ │ └─┬ [email protected]
│ │ ├── [email protected] deduped
│ │ └── [email protected] deduped
│ ├── [email protected] deduped
│ └── [email protected] deduped

The error doesn't give me much info as to what's going on...any pointers?

When minifying with same src and ext output files aren't minified

Edit: Nevermind, my bad, I overlooked the noSource: true option that does exactly this, it solved my issue! Still, I believe gulp-minify should automatically skip saving original source files if it detects that ext.src == ext.min.

Pre-edit:
I have this simple piece of code that does not work:

//minify js
gulp.task('buildminify', ['buildcore', 'buildrequire'], function(){
    return gulp.src('tmp/scripts/**/*.js', {base: './'})
        .pipe(minifyJS({
            ext:{
                src: '.js',
                min: '.js'
            }
        }))
        .pipe(gulp.dest('./'));
});

Of course, when I change min: '.js' to min: '.min.js' files are being created and minified properly and I get both original files and the minified files in the target folders. But if I leave extensions the same output files aren't being overwritten with their minified versions.

Is this a desired behavior or a limitation of gulp-minify, or perhaps gulp itself?
Is there a way around this except for manually removing original files and renaming minified files after the minification is complete?

Missing LICENSE file

Hi, could you add a LICENSE file (e.g. MIT or Apache 2) to this project, so users of your repository know what they are allowed to do with your source code.

gulp.src('lib/**/*.js') error

Write this is wrong?

There are other ways to solve it

code

gulp.src('lib/*/.js')

gulp.task('compress', function() {
  gulp.src('lib/**/*.js')
    .pipe(minify({
        ext:{
            src:'-debug.js',
            min:'.js'
        },
        exclude: ['tasks'],
        ignoreFiles: ['.combo.js', '-min.js']
    }))
    .pipe(gulp.dest('dist'))
});

run error

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error
    at new JS_Parse_Error (l/node_modules/gulp-minify/node_modules/uglify-js/lib/parse.js:189:18)
at js_error (node_modules/gulp-minify/node_modules/uglify-js/lib/parse.js:197:11)
    at croak ( node_modules/gulp-minify/node_modules/uglify-js/lib/parse.js:656:9)
    at token_error ( /node_modules/gulp-minify/node_modules/uglify-js/lib/parse.js:664:9)
    at expect_token (node_modules/gulp-minify/node_modules/uglify-js/lib/parse.js:677:9)
    at expect ( /node_modules/gulp-minify/node_modules/uglify-js/lib/parse.js:680:36)
    at expr_list /node_modules/gulp-minify/node_modules/uglify-js/lib/parse.js:1172:44)
    at subscripts /node_modules/gulp-minify/node_modules/uglify-js/lib/parse.js:1310:30)
    at expr_atom (/node_modules/gulp-minify/node_modules/uglify-js/lib/parse.js:1164:20)
    at maybe_unary (l/node_modules/gulp-minify/node_modules/uglify-js/lib/parse.js:1327:19)

non-vinyl object

Using Gulp 4 and Node v10.15.1 NPM 6.4.1 I've got following error, how I can fix it?

Error: Received a non-Vinyl object in `dest()`
    at DestroyableTransform.normalize [as _transform] (C:\Users\KV\Local Sites\foodora\app\public\wp-content\themes\foodora-kurier\node_modules\vinyl-fs\lib\dest\prepare.js:16:17)
    at DestroyableTransform.Transform._read (C:\Users\KV\Local Sites\foodora\app\public\wp-content\themes\foodora-kurier\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:184:10)
    at DestroyableTransform.Transform._write (C:\Users\KV\Local Sites\foodora\app\public\wp-content\themes\foodora-kurier\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:172:83)
    at doWrite (C:\Users\KV\Local Sites\foodora\app\public\wp-content\themes\foodora-kurier\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:428:64)
    at writeOrBuffer (C:\Users\KV\Local Sites\foodora\app\public\wp-content\themes\foodora-kurier\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:417:5)
    at DestroyableTransform.Writable.write (C:\Users\KV\Local Sites\foodora\app\public\wp-content\themes\foodora-kurier\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:334:11)
    at Pumpify.Duplexify._write (C:\Users\KV\Local Sites\foodora\app\public\wp-content\themes\foodora-kurier\node_modules\duplexify\index.js:208:22)
    at doWrite (C:\Users\KV\Local Sites\foodora\app\public\wp-content\themes\foodora-kurier\node_modules\duplexify\node_modules\readable-stream\lib\_stream_writable.js:428:64)
    at writeOrBuffer (C:\Users\KV\Local Sites\foodora\app\public\wp-content\themes\foodora-kurier\node_modules\duplexify\node_modules\readable-stream\lib\_stream_writable.js:417:5)
    at Pumpify.Writable.write (C:\Users\KV\Local Sites\foodora\app\public\wp-content\themes\foodora-kurier\node_modules\duplexify\node_modules\readable-stream\lib\_stream_writable.js:334:11)

Upgrade to Gulp 4

Please, upgrade to Gulp 4, because it crashes:

Error: Received a non-Vinyl object in `dest()`
    at DestroyableTransform.normalize [as _transform] (/develop/myApp/node_modules/vinyl-fs/lib/dest/prepare.js:16:17)
    at DestroyableTransform.Transform._read (/develop/myApp/node_modules/readable-stream/lib/_stream_transform.js:182:10)
    at DestroyableTransform.Transform._write (/develop/myApp/node_modules/readable-stream/lib/_stream_transform.js:170:83)
    at doWrite (/develop/myApp/node_modules/readable-stream/lib/_stream_writable.js:406:64)
    at writeOrBuffer (/develop/myApp/node_modules/readable-stream/lib/_stream_writable.js:395:5)
    at DestroyableTransform.Writable.write (/develop/myApp/node_modules/readable-stream/lib/_stream_writable.js:322:11)
    at Pumpify.Duplexify._write (/develop/myApp/node_modules/duplexify/index.js:212:22)
    at doWrite (/develop/myApp/node_modules/readable-stream/lib/_stream_writable.js:406:64)
    at writeOrBuffer (/develop/myApp/node_modules/readable-stream/lib/_stream_writable.js:395:5)
    at Pumpify.Writable.write (/develop/myApp/node_modules/readable-stream/lib/_stream_writable.js:322:11)
    at DestroyableTransform.ondata (/develop/myApp/node_modules/readable-stream/lib/_stream_readable.js:612:20)
    at DestroyableTransform.emit (events.js:160:13)
    at addChunk (/develop/myApp/node_modules/readable-stream/lib/_stream_readable.js:284:12)
    at readableAddChunk (/develop/myApp/node_modules/readable-stream/lib/_stream_readable.js:271:11)
    at DestroyableTransform.Readable.push (/develop/myApp/node_modules/readable-stream/lib/_stream_readable.js:238:10)
    at DestroyableTransform.Transform.push (/develop/myApp/node_modules/readable-stream/lib/_stream_transform.js:146:32)

But the last Gulp 3 version works great!

Let error when I run the task

I have this gulp task:

gulp.task('make:js', function () {
    return gulp.src(files.js.src)
    .pipe($.concat(app.name + '.js'))
    .pipe(jsValidate())
    .pipe($.minify({
        ext:{
            min:'.min.js'
        },
        noSource: true,
        preserveComments: ['some'],
        mangle: false
    }))
    .pipe(gulp.dest(files.js.dest));
});

And It's run normally, perfectly... But if I declare my variables using "let" rather than "var", my task starts and pause... forever...

Anyone already seen the same thing or something about this?

Minify just one file

Hi
Trying to use and promote this as there doesnt seem to be good options for gulp and js minifiation yet...
I am falling down though as I am trying to specify a single file in the src...
Also needs ext documenting better - what other extensions would be minified other than js ?
Thanks for helping me to understand.

ignoreFiles doesn't work

I have the following:

gulp.task('build-js', function() {
    return gulp.src(['js/src/**/*.js', '!JS_TEMPLATE_FULL.js, !JS_TEMPLATE_MIN.js'])
        .pipe(plumber(function (error) {
            gutil.log(error.message);
            this.emit('end');
        }))
        .pipe(minify({
            noSource: false,
            ignoreFiles: ['min.js']
        }))
        .pipe(gulp.dest('js/dist'))
        .pipe(browserSync.reload({stream:true}))
        ;
});

I've tried with: ignoreFiles: ['min.js'] and ignoreFiles: ['.min.js'](my files are .min) but it still minifies those and appends the -min.js to the file name

error handling incorrect for uglify-es

     try {
       mangled = uglify.minify(String(file.contents), uglifyOptions);
+      if (mangled.error) throw mangled.error;
       min_file.contents = new Buffer(mangled.code.replace(reSourceMapComment, ''));
     } catch (e) {
       this.emit('end');
       return callback(new PluginError('gulp-minify', formatError(e, file)));
     }

See: https://github.com/mishoo/UglifyJS2/blob/harmony/README.md#api-reference

Note: unlike [email protected], the 3.x API does not throw errors. To achieve a similar effect one could do the following:

var result = UglifyJS.minify(code, options);
if (result.error) throw result.error;

No error during minification

Plugin does not emit an error when minified file contains an error, thus its impossible to display an error to user and stop the script.
Changing :
return new PluginError('gulp-minify', e.toString(e));
to:
this.emit('error', new PluginError('gulp-minify', e.toString(e)));
seem s to be solving a problem

ascii only options not available

iam trying to minify emojione npm package with gulp-minify package. After minifying and trying to access the code iam getting this error .
image
when browsed about this issue i came to know that making ascii_only options to true might fix the above issue , but this option is not present or might be iam unable to find it .
Can u let me know is there any alternative present for it

confused as to difference between gulp-minify and gulp-uglify

This may be a dumb request, but quick comparisons sometimes quickly explain.

Could you draw out a quick comparison in the Readme.md for this lib compared to gulp-uglify.

I don't know what the difference is between minification and uglification, only that the former may include concatenation? dunno

SyntaxError: Invalid assignment

I encountered the SyntaxError: Invalid assignment for the code which is javascript promise.

Last time when I faced and gulp util deprecation issue, i upgraded my gulp minify to gulp-minify@es5 and now when I have implemented the javascript promise functionality, i observe the mentioned Syntax error. during minification.

Below is the dependecies:

 "gulp": "^3.9.1",
    "gulp-clean": "^0.3.2",
    "gulp-clean-css": "^3.9.2",
    "gulp-copy": "^1.0.1",
    "gulp-gzip": "^1.4.0",
    "gulp-htmlmin": "^4.0.0",
    "gulp-minify": "0.0.15",
    "gulp-rename": "^1.2.2"

Please suggest, what needs to be done here.

Doesn't update minified file on re-compiling.

After changing some code in my Javascript file and re-compiling the code, the minified version of it does not get updated even though the debug version does.
My gulp-file:

var minify = require('gulp-minify');
gulp.task('jsCompress', function() {
  return gulp.src('./js/*.js')
    .pipe(minify({
      ext: {
        src: '.debug.js',
        min: '.min.js'
      },
      mangle: false,
      compress: false,
      ignoreFiles: ['.combo.js', '*.min.js', '*.debug.js']
    }))
    .pipe(gulp.dest('./js')) //same directory as the source directory
});
gulp.task('default', ['jsCompress']);

How to improve performance?

I miss some performance options. For my project, minify takes 4 minutes on my 24 core machine and it's using one core I think.

Can't that be tweaked to run in multiple processes? If not, can't the tool report on what took so long? Can't it cache some data, so that same input doesn't need lengthy processing again?

'preserveComments': 'some' option fails with error

When I try using the 'some' setting with gulp-minify I get an error and it fails. Here's is a copy of the error output I get:

D:\repos\local\incident_report\node_modules\promised-io\promise.js:242
                        throw error;
                        ^

TypeError: Cannot set property 'comments' of undefined
    at Transform.minify [as _transform] (D:\repos\local\incident_report\node_modules\gulp-minify\index.js:88:28)
    at Transform._read (D:\repos\local\incident_report\node_modules\gulp-minify\node_modules\readable-stream\lib\_stream_transform.js:184:10)
    at Transform._write (D:\repos\local\incident_report\node_modules\gulp-minify\node_modules\readable-stream\lib\_stream_transform.js:172:12)
    at doWrite (D:\repos\local\incident_report\node_modules\gulp-minify\node_modules\readable-stream\lib\_stream_writable.js:237:10)
    at writeOrBuffer (D:\repos\local\incident_report\node_modules\gulp-minify\node_modules\readable-stream\lib\_stream_writable.js:227:5)
    at Transform.Writable.write (D:\repos\local\incident_report\node_modules\gulp-minify\node_modules\readable-stream\lib\_stream_writable.js:194:11)
    at write (D:\repos\local\incident_report\node_modules\gulp-modernizr\node_modules\readable-stream\lib\_stream_readable.js:623:24)
    at flow (D:\repos\local\incident_report\node_modules\gulp-modernizr\node_modules\readable-stream\lib\_stream_readable.js:632:7)
    at Transform.pipeOnReadable (D:\repos\local\incident_report\node_modules\gulp-modernizr\node_modules\readable-stream\lib\_stream_readable.js:664:5)
    at emitNone (events.js:67:13)
    at Transform.emit (events.js:166:7)

Here's the related gulp task I'm using it in:

var gulp   = require('gulp');
var minify = require('gulp-minify');
var modernizr = require('gulp-modernizr');
var newer  = require('gulp-newer');
gulp.task('update:srcModernizr', function ()
{
    var moduleFiles    = 'node_modules/modernizr/src/**/*.js';
    var outputDir      = 'src/js/vendor/';
    var outFileName    = 'modernizr.js';
    var resultFileName = outputDir + outFileName;
    gulp.src(moduleFiles)
        .pipe(newer(resultFileName))
        .pipe(modernizr(outFileName))
        .pipe(minify({ 'preserveComments': 'some' }))
        .pipe(gulp.dest(outputDir));
});

After some more testing it seems to also fail for 'all'.
With a little more research I think I've figured out what the problems are. Instead of options.output.comments = ... it should be options.comments = ...

Gulp-util deprecation

Gulp-util is deprecated. Please see advice here: https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5

Issue on update to 1.0.0

After update to 1.0.0 i get below error. I use your module inside mine.

Cannot read property 'replace' of undefined (line: undefined, col: undefined, pos: undefined
    at Transform.minify [as _transform] (\node_modules \gulp-minify\index.js:120:50)
    at Transform._read (\node_modules\gulp-minify\node _modules\readable-stream\lib\_stream_transform.js:184:10)
    at Transform._write (\node_modules\gulp-minify\nod e_modules\readable-stream\lib\_stream_transform.js:172:12)
    at doWrite (\node_modules\gulp-minify\node_modules \readable-stream\lib\_stream_writable.js:237:10)
    at writeOrBuffer (\node_modules\gulp-minify\node_m odules\readable-stream\lib\_stream_writable.js:227:5)
    at Transform.Writable.write (\node_modules\gulp-mi nify\node_modules\readable-stream\lib\_stream_writable.js:194:11)
    at DestroyableTransform.ondata (\node_modules\read able-stream\lib\_stream_readable.js:546:20)
    at emitOne (events.js:96:13)
    at DestroyableTransform.emit (events.js:188:7)
    at readableAddChunk (\node_modules\readable-stream \lib\_stream_readable.js:217:18)
    at DestroyableTransform.Readable.push (\node_modul es\readable-stream\lib\_stream_readable.js:176:10)
    at DestroyableTransform.Transform.push (\node_modu les\readable-stream\lib\_stream_transform.js:123:32)
    at DestroyableTransform.sourceMapWrite [as _transform] (C:\Users\crack\AppData\Roaming\npm\node_modul es\waw\node_modules\gulp-sourcemaps\src\write\index.js:61:10)
    at DestroyableTransform.Transform._read (\node_mod ules\readable-stream\lib\_stream_transform.js:159:10)
    at DestroyableTransform.Transform._write (\node_mo dules\readable-stream\lib\_stream_transform.js:147:83)
    at doWrite (\node_modules\readable-stream\lib\_str eam_writable.js:345:64)
    at writeOrBuffer (\node_modules\readable-stream\li b\_stream_writable.js:334:5)
    at DestroyableTransform.Writable.write (\node_modu les\readable-stream\lib\_stream_writable.js:271:11)
    at DestroyableTransform.ondata (\node_modules\read able-stream\lib\_stream_readable.js:546:20)
    at emitOne (events.js:96:13)
    at DestroyableTransform.emit (events.js:188:7)
    at readableAddChunk (\node_modules\readable-stream \lib\_stream_readable.js:217:18)
    at DestroyableTransform.Readable.push (\node_modul es\readable-stream\lib\_stream_readable.js:176:10)
    at DestroyableTransform.Transform.push (\node_modu les\readable-stream\lib\_stream_transform.js:123:32)
    at DestroyableTransform._transform (\node_modules\ gulp-ng-annotate\index.js:76:10)
    at DestroyableTransform.Transform._read (\node_mod ules\readable-stream\lib\_stream_transform.js:159:10)
    at DestroyableTransform.Transform._write (\node_mo dules\readable-stream\lib\_stream_transform.js:147:83)
    at doWrite (\node_modules\readable-stream\lib\_str eam_writable.js:345:64)

gulp-minify gets confused by default values for parameters

gulp-minify triggers an error when trying to parse functions that have default values assigned to its parameters.

function constructCampaign(campaign, output_description = false) {
...
}

Triggers this error:

[12:05:04] Plumber found unhandled error: Error in plugin 'gulp-minify' www/js/script.js SyntaxError: Unexpected token operator «=», expected punc «,» (line: 4512, col: 56, pos: 222911

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.