Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't htmlmin after useref #55

Closed
elado opened this issue Sep 10, 2014 · 3 comments
Closed

Can't htmlmin after useref #55

elado opened this issue Sep 10, 2014 · 3 comments

Comments

@elado
Copy link

elado commented Sep 10, 2014

useref works great, htmlmin works great too, but one after another they cause an error:

  return gulp.src('.tmp/*.html')
    .pipe(assets)
    .pipe($.if('*.js', $.uglify()))
    .pipe($.if('*.css', $.csso()))
    .pipe(assets.restore())
    .pipe($.useref())
    .pipe($.htmlmin())
    .pipe(gulp.dest("dist"))
    .pipe($.size());

Error:

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: no writecb in Transform class
  at afterTransform (/app/node_modules/gulp-uglify/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:95:33)
  at TransformState.afterTransform (/app/node_modules/gulp-uglify/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:79:12)
  at /app/node_modules/gulp-uglify/index.js:70:12
  at minify (/app/node_modules/gulp-uglify/index.js:18:3)
  at DestroyableTransform.uglify [as _transform] (/app/node_modules/gulp-uglify/index.js:68:3)
  at DestroyableTransform.Transform._read (/app/node_modules/gulp-uglify/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
  at DestroyableTransform.Transform._write (/app/node_modules/gulp-uglify/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:12)
@jonkemp
Copy link
Owner

jonkemp commented Sep 11, 2014

You probably need to use gulp-if to only minify HTML files. Useref.assets puts the js and CSS files in the stream.

@jonkemp
Copy link
Owner

jonkemp commented Sep 11, 2014

Although looking at your error logs, it looks like the problem is with uglify.

@shinnn
Copy link
Contributor

shinnn commented Sep 11, 2014

I created the same gulpfile and tried to run it. It throws an error which is very similar to the one @elado ran into.

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: no writecb in Transform class

( ... )

And, after I updated the task to .pipe($.if('*.html', $.htmlmin())), it doesn't throw any errors.

@jonkemp jonkemp closed this as completed Sep 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants