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

upgrade to 3.x breaks old gulp file with useref.assets #153

Closed rwillmer closed 8 years ago

rwillmer commented 8 years ago

You get this error

TypeError: $.useref.assets is not a function

rwillmer commented 8 years ago

I think it would be really useful for the v3 documentation to show the difference between v2 and v3 usage. I'll do a Pull Request if you agree.

The v2.x documentation gives this usage example:

var gulp = require('gulp'),
    useref = require('gulp-useref');

gulp.task('default', function () {
  var assets = useref.assets();

  return gulp.src('app/*.html')
    .pipe(assets)
    .pipe(assets.restore())
    .pipe(useref())
    .pipe(gulp.dest('dist'));
});

The v3.x documentation gives this:

var gulp = require('gulp'),
  useref = require('gulp-useref');

gulp.task('default', function () {
  return gulp.src('app/*.html')
    .pipe(useref())
    .pipe(gulp.dest('dist'));
});
rwillmer commented 8 years ago

Here's a link to the old API

https://github.com/jonkemp/gulp-useref/tree/v.2.1.0

jonkemp commented 8 years ago

Sure, I think v3 is pretty well documented, but if you would like to add something showing the difference between the two, I'll look at it.

nicholasglazer commented 8 years ago

@rwillmer thanks!