mercredi 21 juin 2017

Laravel Elixer not able to minify and version javascript files

i am using laravel 5.1 elixer to manage, version, minify my application css and js

Below is my gulpfile.js

elixir(function (mix) {
    mix.less([
        'app.less',
        'creative.less',
        'mixins.less',
        'variables.less'
    ]).less([
        'dashboard.less',
        'component.less',
        'app-variables.less'
    ], 'public/css/dashboard.css')

    mix.scriptsIn('public/js/angular/controller', 'public/js/angular/appControllers.min.js');
    mix.scriptsIn('public/js/angular/service', 'public/js/angular/appServices.min.js');
    mix.scriptsIn('public/js/angular/directive', 'public/js/angular/appDerictives.min.js');

    mix.version([
        'public/css/dashboard.css',
        'public/css/app.css',
        'public/js/angular/appControllers.min.js',
        'public/js/angular/appServices.min.js',
        'public/js/angular/appDerictives.min.js'
    ]);
});

Everything works fine when i run the command gulp, i get the compiled files and also the versions files are now in the build folder.

The problem starts when i use gulp --production, When laravel starts the process is breaks when starting with scripts, below is the error -

events.js:141
 throw er; // Unhandled 'error' event
 ^
Error at new JS_Parse_Error (eval at <anonymous (/Users/apple/code/hireajackal/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1534:18)
at js_error (eval at <anonymous> (/Users/apple/code/hireajackal/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1542:11)
at croak (eval at <anonymous> (/Users/apple/code/hireajackal/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2089:9)
at token_error (eval at <anonymous> (/Users/apple/code/hireajackal/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2097:9)
at unexpected (eval at <anonymous> (/Users/apple/code/hireajackal/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2103:9)
at expr_atom (eval at <anonymous> (/Users/apple/code/hireajackal/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2630:9)
at maybe_unary (eval at <anonymous> (/Users/apple/code/hireajackal/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2792:19)
at expr_ops (eval at <anonymous> (/Users/apple/code/hireajackal/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2827:24)
at maybe_conditional (eval at <anonymous> (/Users/apple/code/hireajackal/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2832:20)
at maybe_assign (eval at <anonymous> (/Users/apple/code/hireajackal/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2856:20)

The problem is surely with the scriptsIn part of gulp file, or i could say that gulp is not able to minify the js files.

I have tried debugging this through multiple ways, but still not able to find the problem. Tried to update/downgrade the relevant packages, but even that didn't help.

Any help would be appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire