gulp-inject は event-stream では機能しません。
var gulp = require('gulp');
var mainBowerFiles = require('main-bower-files');
var inject = require('gulp-inject');
var es = require('event-stream');
var config = {
sassDir: './resources/assets/sass',
jsPath: './resources/app',
fontDir: './resources/fonts',
imageDir: './resources/images',
bowerDir: './bower_components'
};
gulp.task('index', function () {
return gulp.src('./resources/index.html')
.pipe(inject(gulp.src(mainBowerFiles('**/*.js'), {read: false}), {name: 'bower'}))
.pipe(inject(es.merge(gulp.src(config.jsPath + '/**/*.js', {read: false}))))
.pipe(gulp.dest('./public'));
});
結果はこのようになります。
<!-- inject:js -->
<script src="/resources/app/core.js"></script>
<script src="/resources/app/first-folder/01.js"></script>
<script src="/resources/app/second-folder/02.js"></script>
<!-- endinject -->
残念ながら、mainBowerFiles('**/*.js')
とは合併しませんinject(es.merge(gulp.src(config.jsPath + '/**/*.js', {read: false})))