jonkemp / jonkemp/gulp-useref

Migration from John Papa version 2 to version 3.0.0 half working.

Open
#178 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
700
Forks
89
PR merge metrics
No merged PRs in 30d

Description

Hi. There. At first, thanks for the awesome library.
However, i got trouble to migrate from John Papa version 2 to version 3. I think i am not understanding 'searchPath'.

Here is original version 2 from JohnPapa pluralsigh course:
gulp.task('optimize', ['inject'], function(){
log('optimizing the javascript, css, html');
var useref = $.useref;
var assets = $.useref.assets({searchPath: './'});
var templateCache = config.temp + config.templateCache.file;
return gulp
.src(config.index)
.pipe($.plumber())
//TODO process
.pipe($.inject(gulp.src(templateCache, {read: false}), {
starttag: ''
}))
.pipe(assets)
.pipe(assets.restore())
.pipe(useref())
.pipe(gulp.dest(config.build));
});

Here is version 3 after follow documentation, i cant get var useref = $.useref({searchPath: './'}) working. So i have to use array option of useref. This version got .tmp folder working, bower_components folder working but not src folder. **Any ideas?**

gulp.task('optimize', ['inject'], function(){
log('optimizing the javascript, css, html');
var useref = $.useref({searchPath: ['.tmp', 'src' , './bower_components']});
var templateCache = config.temp + config.templateCache.file;
return gulp
.src(config.index)
.pipe($.plumber())
//TODO process
.pipe($.inject(gulp.src(templateCache, {read: false}), {
starttag: ''
}))
.pipe(useref)
.pipe(gulp.dest(config.build));
});

BTW: my folder structure is .tmp, bower_components, src and others) under root directory.

And this is key placeholder in my index.html

```

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.