Socket.io script size reduce
socket.io source script goes like 70k, a great part is comments, spaces...
I need to reduce that script to a smaller size Some scripts do not even have spaces and the code is all toghether, this reduces the script original size.
Where is the location of the socket.io script so that I can remove comments and spaces? Or is there a socket.io allready whithout comments and spaces with a smaller size?
There is a setting in the socket.io configuration for this:
https://github.com/LearnBoost/Socket.IO/wiki/Configuring-Socket.IO
browser client minification defaults to false
Does Socket.IO need to send a minified build of socket.io.js.
You may also enable gzip compression on the library.
The client .js file is in *yourdir*/node_modules/socket.io/node_modules/socket.io-client/dist
There is one file called socket.io.min.js
which is minified already.
The OP fixed the problem by going to /node_modules/socket.io/lib
and editing 'manager.js', to set both "minification" and "gzip compression" to "true". They had to do this way because because they were using nowJS which indirectly uses 'socket.io'
This reduced the file from 70k to about 4k!
链接地址: http://www.djcxy.com/p/63174.html上一篇: socket.io示例:不工作
下一篇: Socket.io脚本大小减小