Using gulp and wiredep, socket.io is not added to index.html (even if it is in bower.json)

I have angular, angular -ui-router and socket-io in my bower.json file.

When I run my gulp file (using wiredep), two angular scripts are successfully added to my index.html file, but there is no socket.io script - and I cannot understand why. Thanks for any help

//command line

[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"
  }
+4
source share
2 answers

Socket.io itself does not support memory support, remember that this is a server, not a client.

script , serveClient true index

 <script src="socket.io/socket.io.js"></script>

script, , :

bower install -save socket.io-client

main, bower.json:

"overrides": {
  "socket.io-client": {
    "main": "socket.io.js"
  }
}

, wiredep index.html.

+10

main t20 > <, , wiredep , bower.json bower_components/socket.io/, , . , , socket.io ?

+1

All Articles