Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asynchronous Execution of Laravel Elixir Commands

I'm having some trouble with Laravel Elixir and working out in what order things are executed. I've been let to believe that chaining elixir calls will force them to execute synchronously but I've had issues where in certain circumstances certain commands don't seem to execute or appear to execute in an order that means they don't complete properly.

My first issue was that the dependencies.js file was never being versioned by the version() function until I swapped the two scripts() functions round, so the one for dependencies.js ran second.

Another issue is that when I run the tasks through the gulp function, the majority of times, the font-awesome fonts get copied to the build directory. However, when running gulp watch they often get omitted.

I'm able to work around both of these problems, but I keep seeing little things like this that make me think I don't fully understand execution order and subtleties around it. Does anyone know if I'm missing something obvious?

Thanks.

Here's my gulpfile.js code:

mix.sass("app.scss", 'public/css/', {
        includePaths: [paths.bootstrap + 'stylesheets/']
    })
    .scripts([
        'js/app.js'
    ], 'public/js/app.js', paths.assets)
    .scripts([
        // paths.jquery + "dist/jquery.js",
        paths.bootstrap + "javascripts/bootstrap.js",
        paths.assets + "js/freelancer/classie.js",
        paths.assets + "js/freelancer/cbpAnimatedHeader.js",
        paths.assets + "js/freelancer/jqBootstrapValidation.js",
        paths.assets + "js/freelancer/contact_me.js",
        paths.assets + "js/freelancer/freelancer.js"
    ], 'public/js/dependencies.js', './')
    .version([
        'public/js/dependencies.js',
        'public/js/app.js',
        'public/css/app.css'])
    .copy(paths.bootstrap + 'fonts/bootstrap/**', 'public/build/fonts')
    .copy(paths.assets + 'fonts/font-awesome/', 'public/build/fonts');
like image 516
Simon Avatar asked Feb 12 '15 12:02

Simon


1 Answers

Laravel Elixir recently got updated and one of the first things this article talks about is the order of which things run.

It seems to have been a bug which is fixed in the latest version:

https://laravel-news.com/2015/07/laravel-elixir-version-3-is-released/

like image 72
Jamesking56 Avatar answered Oct 10 '22 19:10

Jamesking56