Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Elixir not combining scripts

I just did a clean install of laravel. Elixir is not combining my scripts. I am clueless about what's happening. I see the scripts task getting triggered but no files are output in public/js directory.

This is my gulpfile.js:

elixir(function (mix) {
    mix.sass('style.scss')
        .scripts([
            'vendor/jquery.js',
            'vendor/foundation.min.js',
            'script.js'
        ], 'resources/assets/js', 'public/js/app.min.js')
        .scripts([
            'vendor/modernizr.js'
        ], 'resources/assets/js', 'public/js/modernizr.js');
});

It compiles sass properly.

This is the directory structure: https://www.uploady.com/#!/download/221Y0RI_aYe/V7eKiQHIw2gvyXVD

like image 744
aBhijit Avatar asked Jan 30 '15 17:01

aBhijit


2 Answers

I found the answer. My second and third argument (input and output directory) to the scripts() function should be interchanged. Seems like this changed in the current version of elixir. Happy coding!

Edit (solution):

elixir(function (mix) {
    mix.sass('style.scss')
        .scripts([
            'vendor/jquery.js',
            'vendor/foundation.min.js',
            'script.js'
        ], 'public/js/app.min.js', 'resources/assets/js')
        .scripts([
            'vendor/modernizr.js'
        ], 'public/js/modernizr.js', 'resources/assets/js');
});
like image 118
aBhijit Avatar answered Nov 10 '22 10:11

aBhijit


I found a similar question here: laracast.com
The problem was that the version of laravel-elixir was not the latest version.
So have a look in your package.json and check which version you are running. Maybe your problem is also the version you use for laravel-elixir.

like image 1
stefan Avatar answered Nov 10 '22 11:11

stefan