[英]main-bower-files gulp returns empty array
I'm trying to use the plugin main-bower-files
and it doesn't seem to be able to pull the directory from bower_components. 我正在尝试使用插件
main-bower-files
,它似乎无法从bower_components中提取目录。
Its debug message shows it has the right files, but it doesn't return an array 它的调试消息显示它有正确的文件,但它不返回数组
#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')()
heres my gulp task for inject 注意我的吞咽任务
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'))
})
If you have dependencies as devDependencies in bower.json
you need to add ' includeDev:true
如果你在
bower.json
有依赖关系作为devDependencies,你需要添加' includeDev:true
see 看到
includeDev Type: mixed Default: false
includeDev类型:mixed默认值:false
You can include your devDependencies in two ways:
您可以通过两种方式包含devDependencies:
Set this option to inclusive or true to add the devDependencies to your >dependencies or use exclusive to exclude your dependencies
将此选项设置为inclusive或true可将devDependencies添加到> dependencies或使用exclusive来排除依赖项
You need to install Bower and run Bower install
您需要安装Bower并运行
Bower install
So : 所以:
npm install
to make your project npm ready and install what is in package.json npm install
以使你的项目准备好npm并安装package.json中的内容 sudo npm install -g bower
sudo npm install -g bower
bower install
to copy your bower.json dependencies in ./bower_components
directory bower install
以复制./bower_components
目录中的bower.json依赖./bower_components
npm install -g gulp
npm install -g gulp
gulp build
gulp build
gulp serve
and you're ready for it gulp serve
,你准备好了 Well, almost automatic build... 好吧, 几乎是自动构建......
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.