Closed darky closed 8 years ago
Can you post your gulpfile or try using gulp debug?
Use simple gulp task similar:
gulp.src("/@dev/**/*.html")
.pipe(useref({searchPath: process.cwd() + "/@dev"}))
.pipe(gulp.dest("/@prod"))
And similar concatenate code with many js:
<!-- build:js /js/main.js -->
<script src="/js/jquery.js"></script>
<script src="/plugin/js/jquery.isotope.min.js"></script>
<script src="/js/modernizr.custom.js"></script>
<script src="/js/menu_link_checker.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/owl.carousel.min.js"></script>
<script src="/js/jquery.themepunch.revolution.min.js"></script>
<script src="/js/jquery.themepunch.plugins.min.js"></script>
<script src="/js/retina.js"></script>
<script src="/plugin/js/jquery.mediaBoxes.js"></script>
<script src="/plugin/js/jquery.imagesLoaded.min.js"></script>
<script src="/plugin/js/waypoints.min.js"></script>
<script src="/plugin/js/jquery.magnific-popup.min.js"></script>
<script src="/js/scripts.js"></script>
<script src="/js/parallax.js"></script>
<script src="/js/jquery.appear.js"></script>
<script src="/js/waypoints.min.js"></script>
<script src="/js/bars.ini.js"></script>
<script src="/js/ga.js"></script>
<!-- endbuild -->
Why do you think self.emit('end')
called too early? What problem are you seeing?
Can you try 3.0.0 and see if the problem still occurs?
Why do you think self.emit('end') called too early?
Because help me this code:
setTimeout(function(){
self.emit("end")
}, 3000);
What problem are you seeing?
No main.js in destination folder and next uglify task ended very fast.
Can you try 3.0.0 and see if the problem still occurs?
I try it on all 3.0.x versions. I hope that new 3.0.x solve this problem, but nothing and create this issue on 3.0.4.
Can you try using gulp-debug?
I try using gulp-debug. It's seems ok! All useref logs before uglify and other minify tasks
I suggest you yourself to try build this files:
<!-- build:js /js/main.js -->
<script src="/js/jquery.js"></script>
<script src="/plugin/js/jquery.isotope.min.js"></script>
<script src="/js/modernizr.custom.js"></script>
<script src="/js/menu_link_checker.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/owl.carousel.min.js"></script>
<script src="/js/jquery.themepunch.revolution.min.js"></script>
<script src="/js/jquery.themepunch.plugins.min.js"></script>
<script src="/js/retina.js"></script>
<script src="/plugin/js/jquery.mediaBoxes.js"></script>
<script src="/plugin/js/jquery.imagesLoaded.min.js"></script>
<script src="/plugin/js/waypoints.min.js"></script>
<script src="/plugin/js/jquery.magnific-popup.min.js"></script>
<script src="/js/scripts.js"></script>
<script src="/js/parallax.js"></script>
<script src="/js/jquery.appear.js"></script>
<script src="/js/waypoints.min.js"></script>
<script src="/js/bars.ini.js"></script>
<script src="/js/ga.js"></script>
<!-- endbuild -->
With this setup:
index.html
<html>
<head></head>
<body>
<!-- build:js /js/main.js -->
<script src="/js/jquery.js"></script>
<script src="/plugin/js/jquery.isotope.min.js"></script>
<script src="/js/modernizr.custom.js"></script>
<script src="/js/menu_link_checker.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/owl.carousel.min.js"></script>
<script src="/js/jquery.themepunch.revolution.min.js"></script>
<script src="/js/jquery.themepunch.plugins.min.js"></script>
<script src="/js/retina.js"></script>
<script src="/plugin/js/jquery.mediaBoxes.js"></script>
<script src="/plugin/js/jquery.imagesLoaded.min.js"></script>
<script src="/plugin/js/waypoints.min.js"></script>
<script src="/plugin/js/jquery.magnific-popup.min.js"></script>
<script src="/js/scripts.js"></script>
<script src="/js/parallax.js"></script>
<script src="/js/jquery.appear.js"></script>
<script src="/js/waypoints.min.js"></script>
<script src="/js/bars.ini.js"></script>
<script src="/js/ga.js"></script>
<!-- endbuild -->
</body>
</html>
gulpfile.js
var gulp = require('gulp'),
useref = require('gulp-useref'),
debug = require('gulp-debug');
gulp.task('default', function () {
return gulp.src('./*.html')
.pipe(useref())
.pipe(debug())
.pipe(gulp.dest('dist'));
});
$ gulp
[20:57:10] Using gulpfile /Library/WebServer/Documents/gulp-useref-bug/gulpfile.js
[20:57:10] Starting 'default'...
[20:57:10] gulp-debug: index.html
[20:57:10] gulp-debug: js/main.js
[20:57:10] gulp-debug: 2 items
[20:57:10] Finished 'default' after 323 ms
Works fine for me. What am I missing?
Ran it again without gulp-debug and got the same result.
Your example very poor. It's work for me too. But in project many gulp tasks, which depend on each other.
Then tell me what I should do to reproduce it. And the fact that it works shows that the problem is not with this plugin. I'm still willing to help you regardless.
Try version 3.0.7 if you still have this problem.
On 3.0.4 version I have very strange bug. 2.1.0 not affected. If asset very big, it's can't get in time to be on file system and
self.emit('end');
called too early. Dirty hack help me instead https://github.com/jonkemp/gulp-useref/blob/master/index.js#L205:Seems you need listen some event, when file placed on destination folder and only later call
self.emit('end');