How to get relative source using gulp.src()

Viewed 378

I have a file at /components/slider/index.html. I setup a gulp task that injects related css/js files from separate folders using gulp-inject.

gulp.task('default', function() {

    return gulp.src('./components/**/*.html')
    .pipe( inject(gulp.src(['./assets/css/bootstrap/*.css'], {read: false}), { relative: true }) )
    .pipe( inject(gulp.src(['./assets/js/jquery/*.js'], {read: false}), {starttag: '<!-- inject:head:{{ext}} -->', relative: true} ) )
    .pipe(gulp.dest('./dist'));

});

Now I need to get the source of a js file, located along side of the html source we are pipe-ing, in order to inject it relativley using gulp-inject.

Is there anyway to get gulp.src('./components/**/*.html') in a pipe and somehow get the sibling js file from there? Any suggestion?

1 Answers
Related