jonkemp / gulp-useref

Parse build blocks in HTML files to replace references to non-optimized scripts or stylesheets.
MIT License
705 stars 93 forks source link

useref doesn't process all assets? #176

Closed srtonz closed 8 years ago

srtonz commented 8 years ago

So I was just playing around with a very simple useref task and noticed that only the first 16 assets were copied to the dest() directory.

gulp.task('build-dir', function () {
  return gulp.src('static/index.html')
    .pipe(useref({noconcat: true}))
    .pipe(gulp.dest('build'));
});

This config copied 32 of 55 files from a single block. Removing return from the code above only copies 16 files.

I tried to add gulp-debug into the pipe just after useref() to see if I'm missing a file somewhere, but instead the whole thing went through and copied all 55 files! Ran a couple of trials with and without debug and the problem persists: only half the files are copied without debug, all of them are copied with debug.

jonkemp commented 8 years ago

What version are you using?

srtonz commented 8 years ago

@jonkemp sorry forgot, that's v3.0.5

jonkemp commented 8 years ago

There was a previous issue with this which has been fixed.

102

Test cases were added to solve the issue and make sure it doesn't happen again. Those tests still pass. So I'm not sure what the problem is or how to fix it. Maybe we can increase the number of files in the test to try and make it fail?

srtonz commented 8 years ago

@jonkemp I saw #102, but it seems to be about parsing multiple html files. My issue is about many js assets in a single .html file. Not a huge problem because debug() does fix it for me (even on a new project), but curious :)

jonkemp commented 8 years ago

Ah I see, well maybe a similar test will help for this issue.

jonkemp commented 8 years ago

This issue maybe related as well.

162

brunnurs commented 8 years ago

Seems to be the same issue for me... I'm working with Version 3.0.5 and not all html-files are copied correctly, but no error on the console. Hard to reproduce the issue, as it seems to be non-deterministic. (Ofc it's not, but it feels like)

asselin commented 8 years ago

I ran into this issue as well. I believe the root of the problem is that you're emitting an end event in streamManager instead of calling the flush function's callback. I'll submit a PR that fixes this shortly.

jemmyzheng commented 8 years ago

so helpful ,I try whole afternoon to find why, until see this issues! Thank u @GeoTob !

jonkemp commented 8 years ago

Should be fixed with 3.0.7.

TCB13 commented 7 years ago

I'm experiencing this issue back. Version 3.1.2

jonkemp commented 7 years ago

@TCB13 what's the issue?

TCB13 commented 7 years ago

@jonkemp seems like gulp-useref is missing assets. My 4th css file never shows on debug. I've a total of 17 files (including JS and HTML) being processed on the pipeline.

jonkemp commented 7 years ago

@TCB13 can you provide more info?

TCB13 commented 7 years ago

@jonkemp Never mind, my mistake. Sorry.