{"action":"created","issue":{"url":"https://api.github.com/repos/jonkemp/gulp-useref/issues/162","labels_url":"https://api.github.com/repos/jonkemp/gulp-useref/issues/162/labels{/name}","comments_url":"https://api.github.com/repos/jonkemp/gulp-useref/issues/162/comments","events_url":"https://api.github.com/repos/jonkemp/gulp-useref/issues/162/events","html_url":"https://github.com/jonkemp/gulp-useref/issues/162","id":123172247,"number":162,"title":"Big asset can't get in time to be on destination place","user":{"login":"darrrk","id":1832800,"avatar_url":"https://avatars.githubusercontent.com/u/1832800?v=3","gravatar_id":"","url":"https://api.github.com/users/darrrk","html_url":"https://github.com/darrrk","followers_url":"https://api.github.com/users/darrrk/followers","following_url":"https://api.github.com/users/darrrk/following{/other_user}","gists_url":"https://api.github.com/users/darrrk/gists{/gist_id}","starred_url":"https://api.github.com/users/darrrk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darrrk/subscriptions","organizations_url":"https://api.github.com/users/darrrk/orgs","repos_url":"https://api.github.com/users/darrrk/repos","events_url":"https://api.github.com/users/darrrk/events{/privacy}","received_events_url":"https://api.github.com/users/darrrk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-12-20T17:20:01Z","updated_at":"2015-12-29T02:02:01Z","closed_at":null,"body":"On 3.0.4 version I have very strange bug. 2.1.0 not affected.\r\nIf asset very big, it's can't get in time to be on file system and `self.emit('end');` called too early.\r\nDirty hack help me instead https://github.com/jonkemp/gulp-useref/blob/master/index.js#L205:\r\n```javascript\r\nsetTimeout(function(){\r\n  self.emit(\"end\")\r\n}, 3000);\r\n``` \r\nSeems you need listen some event, when file placed on destination folder and only later call `self.emit('end');`"},"comment":{"url":"https://api.github.com/repos/jonkemp/gulp-useref/issues/comments/167698880","html_url":"https://github.com/jonkemp/gulp-useref/issues/162#issuecomment-167698880","issue_url":"https://api.github.com/repos/jonkemp/gulp-useref/issues/162","id":167698880,"user":{"login":"jonkemp","id":230683,"avatar_url":"https://avatars.githubusercontent.com/u/230683?v=3","gravatar_id":"","url":"https://api.github.com/users/jonkemp","html_url":"https://github.com/jonkemp","followers_url":"https://api.github.com/users/jonkemp/followers","following_url":"https://api.github.com/users/jonkemp/following{/other_user}","gists_url":"https://api.github.com/users/jonkemp/gists{/gist_id}","starred_url":"https://api.github.com/users/jonkemp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonkemp/subscriptions","organizations_url":"https://api.github.com/users/jonkemp/orgs","repos_url":"https://api.github.com/users/jonkemp/repos","events_url":"https://api.github.com/users/jonkemp/events{/privacy}","received_events_url":"https://api.github.com/users/jonkemp/received_events","type":"User","site_admin":false},"created_at":"2015-12-29T02:02:01Z","updated_at":"2015-12-29T02:02:01Z","body":"With this setup:\r\n\r\nindex.html\r\n```html\r\n<html>\r\n<head></head>\r\n<body>\r\n  <!-- build:js /js/main.js -->\r\n  <script src=\"/js/jquery.js\"></script>\r\n  <script src=\"/plugin/js/jquery.isotope.min.js\"></script>\r\n  <script src=\"/js/modernizr.custom.js\"></script>\r\n  <script src=\"/js/menu_link_checker.js\"></script>\r\n  <script src=\"/js/bootstrap.min.js\"></script>\r\n  <script src=\"/js/owl.carousel.min.js\"></script>\r\n  <script src=\"/js/jquery.themepunch.revolution.min.js\"></script>\r\n  <script src=\"/js/jquery.themepunch.plugins.min.js\"></script>\r\n  <script src=\"/js/retina.js\"></script>\r\n  <script src=\"/plugin/js/jquery.mediaBoxes.js\"></script>\r\n  <script src=\"/plugin/js/jquery.imagesLoaded.min.js\"></script>\r\n  <script src=\"/plugin/js/waypoints.min.js\"></script>\r\n  <script src=\"/plugin/js/jquery.magnific-popup.min.js\"></script>\r\n  <script src=\"/js/scripts.js\"></script>\r\n  <script src=\"/js/parallax.js\"></script>\r\n  <script src=\"/js/jquery.appear.js\"></script>\r\n  <script src=\"/js/waypoints.min.js\"></script>\r\n  <script src=\"/js/bars.ini.js\"></script>\r\n  <script src=\"/js/ga.js\"></script>\r\n  <!-- endbuild -->\r\n</body>\r\n</html>\r\n```\r\n\r\ngulpfile.js\r\n```js\r\nvar gulp = require('gulp'),\r\n    useref = require('gulp-useref'),\r\n    debug = require('gulp-debug');\r\n\r\ngulp.task('default', function () {\r\n    return gulp.src('./*.html')\r\n        .pipe(useref())\r\n        .pipe(debug())\r\n        .pipe(gulp.dest('dist'));\r\n});\r\n```\r\n\r\n```sh\r\n$ gulp\r\n\r\n[20:57:10] Using gulpfile /Library/WebServer/Documents/gulp-useref-bug/gulpfile.js\r\n[20:57:10] Starting 'default'...\r\n[20:57:10] gulp-debug: index.html\r\n[20:57:10] gulp-debug: js/main.js\r\n[20:57:10] gulp-debug: 2 items\r\n[20:57:10] Finished 'default' after 323 ms\r\n```\r\n\r\nWorks fine for me. What am I missing?"}}