我的 bower.json 文件中有 angular、angular-ui-router 和 socket-io。
当我运行我的 gulp 文件(使用wiredep)时,两个角度脚本已成功添加到我的 index.html 文件中,但 socket.io 脚本没有 - 我不知道为什么。谢谢你的帮助
//命令行
[21:56:06] Using gulpfile ~/dev/projects/ecommerceVidChat/gulpfile.js
[21:56:06] Starting 'default'...
[21:56:06] Starting 'bower-dependencies'...
[21:56:06] Finished 'bower-dependencies' after 6.24 ms
[21:56:06] Finished 'default' after 7.24 ms
//bower.json
"dependencies": {
"angular": "~1.3.13",
"socket.io": "~1.3.4",
"angular-ui-router": "~0.2.13"
}
// gulpfile.js
var gulp = require('gulp'),
wiredep = require('wiredep').stream;
gulp.task('default', function() {
gulp.start('bower-dependencies')
});
gulp.task('bower-dependencies', function () {
gulp.src('./build/index.html')
.pipe(wiredep({
directory: './build/bower_components',
bowerJson: require('./bower.json'),
}))
.pipe(gulp.dest('./build/'));
});
//index.html
<!-- bower:js -->
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script>
<!-- endbower -->
//package.json
"devDependencies": {
"gulp": "^3.8.11"
}