{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/7940","labels_url":"https://api.github.com/repos/laravel/framework/issues/7940/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/7940/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/7940/events","html_url":"https://github.com/laravel/framework/issues/7940","id":60526856,"number":7940,"title":"[L5] Elixir tasks cannot be run asynchronously","user":{"login":"bhatt40","id":3288516,"avatar_url":"https://avatars.githubusercontent.com/u/3288516?v=3","gravatar_id":"","url":"https://api.github.com/users/bhatt40","html_url":"https://github.com/bhatt40","followers_url":"https://api.github.com/users/bhatt40/followers","following_url":"https://api.github.com/users/bhatt40/following{/other_user}","gists_url":"https://api.github.com/users/bhatt40/gists{/gist_id}","starred_url":"https://api.github.com/users/bhatt40/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhatt40/subscriptions","organizations_url":"https://api.github.com/users/bhatt40/orgs","repos_url":"https://api.github.com/users/bhatt40/repos","events_url":"https://api.github.com/users/bhatt40/events{/privacy}","received_events_url":"https://api.github.com/users/bhatt40/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-03-10T16:22:47Z","updated_at":"2015-03-21T20:02:59Z","closed_at":"2015-03-21T20:02:59Z","body":"## Intro\r\n\r\nI have a found a few forum posts referencing this, but there doesn't appear to be a central location for tracking this issue.  According to the [gulp documentation](https://github.com/gulpjs/gulp/blob/master/docs/API.md#async-task-support), gulp tasks are run with maximum concurrency.  To run tasks in a particular order, you must specify this using the methods outlined in their documentation.\r\nI've been attempting to run some of my Elixir tasks asynchronously by wrapping them in gulp.task definitions and using the documented methods. While I've found that these methods work when I'm using other gulp tasks (src, dest, concat, etc.), they don't work when I'm using Elixir tasks.\r\n\r\n## Example\r\n\r\nI created a simple example to demonstrate the issue.  In this case, I'm concatenating two JavaScript files into an intermediate file, then concatenating this file with two more JavaScript files to create my final `app.js` file.  The second concatenation task is dependent on the completion of the first concatenation task.\r\n\r\n### Using Gulp Tasks\r\n\r\nHere's the gulpfile using `src`, `dest`, and `concat` tasks:\r\n\r\n    var gulp = require('gulp'),\r\n        concat = require('gulp-concat');\r\n    \r\n    gulp.task('default', ['second']);\r\n    \r\n    gulp.task('second', ['first'], function() {\r\n        gulp.src(['resources/assets/js/intermediate.js', 'resources/assets/js/file3.js', 'resources/assets/js/file4.js'])\r\n          .pipe(concat('app.js'))\r\n          .pipe(gulp.dest('public/js'));\r\n    });\r\n    \r\n    gulp.task('first', function() {\r\n        return gulp.src(['resources/assets/js/file1.js', 'resources/assets/js/file2.js'])\r\n          .pipe(concat('intermediate.js'))\r\n          .pipe(gulp.dest('resources/assets/js'));\r\n    });\r\n\r\nCalling `gulp` from the command line results in the following output:\r\n\r\n    [10:59:55] Using gulpfile ~/Sites/laravel_5/gulpfile.js\r\n    [10:59:55] Starting 'first'...\r\n    [10:59:55] Finished 'first' after 45 ms\r\n    [10:59:55] Starting 'second'...\r\n    [10:59:55] Finished 'second' after 5.18 ms\r\n    [10:59:55] Starting 'default'...\r\n    [10:59:55] Finished 'default' after 12 μs\r\n\r\nThe resulting `app.js` includes the code from all four files:\r\n\r\n    var file1;\r\n    var file2;\r\n    var file3;\r\n    var file4;\r\n\r\n## Using Elixir Tasks\r\n\r\nHere's the gulpfile using Elixir tasks:\r\n\r\n    var elixir = require('laravel-elixir');\r\n    var gulp = require('gulp');\r\n    \r\n    gulp.task('default', ['second'], function() {});\r\n    \r\n    gulp.task('first', function() {\r\n        return elixir(function (mix) {\r\n            return mix.scripts([\r\n                \"file1.js\",\r\n                \"file2.js\"\r\n            ], \"resources/assets/js/intermediate.js\", \"resources/assets/js\");\r\n    \r\n        });\r\n    });\r\n    \r\n    gulp.task('second', ['first'], function() {\r\n        elixir(function(mix) {\r\n            mix.scripts([\r\n                \"file3.js\",\r\n                \"file4.js\",\r\n                \"intermediate.js\"\r\n            ], \"public/js/app.js\", \"resources/assets/js\");\r\n        })\r\n    });\r\n\r\nCalling `gulp` from the command line results in the following output:\r\n\r\n    [11:11:03] Using gulpfile ~/Sites/laravel_5/gulpfile.js\r\n    [11:11:03] Starting 'first'...\r\n    [11:11:03] Finished 'first' after 303 ms\r\n    [11:11:03] Starting 'second'...\r\n    [11:11:03] Finished 'second' after 1.09 ms\r\n    [11:11:03] Starting 'default'...\r\n    [11:11:03] Starting 'scripts'...\r\n    [11:11:03] Finished 'default' after 72 ms\r\n    [11:11:03] Finished 'scripts' after 103 ms\r\n\r\n Here's the resulting `app.js` file:\r\n\r\n    var file3;\r\n    var file4;\r\n\r\nIt's missing the code that was concatenated into the intermediate file.  I've also tried the other methods from the documentation (accepting a callback and returning a promise), but neither of these worked.  From digging into the Elixir source code, I think this may have to do with Elixir's usage of the run-sequence package, but I'm not sure."},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/84447085","html_url":"https://github.com/laravel/framework/issues/7940#issuecomment-84447085","issue_url":"https://api.github.com/repos/laravel/framework/issues/7940","id":84447085,"user":{"login":"bhatt40","id":3288516,"avatar_url":"https://avatars.githubusercontent.com/u/3288516?v=3","gravatar_id":"","url":"https://api.github.com/users/bhatt40","html_url":"https://github.com/bhatt40","followers_url":"https://api.github.com/users/bhatt40/followers","following_url":"https://api.github.com/users/bhatt40/following{/other_user}","gists_url":"https://api.github.com/users/bhatt40/gists{/gist_id}","starred_url":"https://api.github.com/users/bhatt40/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhatt40/subscriptions","organizations_url":"https://api.github.com/users/bhatt40/orgs","repos_url":"https://api.github.com/users/bhatt40/repos","events_url":"https://api.github.com/users/bhatt40/events{/privacy}","received_events_url":"https://api.github.com/users/bhatt40/received_events","type":"User","site_admin":false},"created_at":"2015-03-21T20:02:59Z","updated_at":"2015-03-21T20:02:59Z","body":"This issue was moved to laravel/elixir#73"}}