我正在尝试使用该插件main-bower-files
,但它似乎无法从 bower_components 中提取目录。
它的调试消息显示它有正确的文件,但它不返回数组
#here you can see the debug finding the places
PackageCollection add angular bower_components/angular
PackageCollection add json3 bower_components/json3
PackageCollection add es5-shim bower_components/es5-shim
PackageCollection add jquery bower_components/jquery
PackageCollection add angular-resource bower_components/angular-resource
PackageCollection add angular-cookies bower_components/angular-cookies
PackageCollection add angular-sanitize bower_components/angular-sanitize
PackageCollection add angular-animate bower_components/angular-animate
PackageCollection add angular-touch bower_components/angular-touch
PackageCollection add angular-ui-router bower_components/angular-ui-router
[22:25:31] [] #< this is the result of calling require('main-bower-files')()
这是我的注入任务
var bowerFiles = require('main-bower-files')
gulp.task('inject', function() {
util.log(bowerFiles({debugging:true}))
gulp.src('app/index.jade')
.pipe(jade({pretty: true}))
.pipe(inject(gulp.src(bowerFiles()), {starttag: '<!-- inject:{{ext}}-->', endtag: '<!-- endinject-->'}))
.pipe(inject(gulp.src('.tmp/**/*.js', {read: false}), {starttag: '<!-- inject:files:{{ext}}-->', endtag: '<!-- endinject-->'}))
.pipe(connect.reload())
.pipe(gulp.dest('.tmp'))
})