File tree Expand file tree Collapse file tree 2 files changed +6
-33
lines changed Expand file tree Collapse file tree 2 files changed +6
-33
lines changed Original file line number Diff line number Diff line change 3
3
*/
4
4
var fs = require ( 'fs' ) ,
5
5
path = require ( 'path' ) ,
6
- os = require ( 'os' ) ;
7
-
8
- var getIp = function ( ) {
9
- var platform = os . platform ( ) ;
10
- var interfaces = os . networkInterfaces ( ) ;
11
- var IPv4 = '127.0.0.1' ;
12
-
13
- if ( platform === 'win32' ) {
14
- var addressMes = interfaces [ '本地连接' ] || interfaces [ '无线网络连接' ] ;
15
- if ( addressMes && addressMes . length ) {
16
- for ( var i = 0 ; i < addressMes . length ; i ++ ) {
17
- if ( addressMes [ i ] [ 'family' ] && addressMes [ i ] [ 'family' ] === 'IPv4' ) {
18
- IPv4 = addressMes [ i ] [ 'address' ] ;
19
- break ;
20
- }
21
- }
22
- }
23
- } else {
24
- for ( var key in interfaces ) {
25
- interfaces [ key ] . forEach ( function ( details ) {
26
- if ( details . family == 'IPv4' && key == 'en0' ) {
27
- IPv4 = details . address ;
28
- }
29
- } ) ;
30
- }
31
- }
32
-
33
- return IPv4 ;
34
- } ;
6
+ localIp = require ( 'quick-local-ip' ) ;
35
7
36
8
module . exports = function ( config ) {
37
9
var html = [
@@ -58,7 +30,7 @@ module.exports = function (config) {
58
30
tmpHtml = '' ,
59
31
length = '/dev/html/' . length ,
60
32
collector = listdir ( './dev/html' ) ,
61
- ip = getIp ( ) ;
33
+ ip = localIp . getLocalIP4 ( ) ;
62
34
63
35
64
36
showdir ( collector , 0 ) ;
Original file line number Diff line number Diff line change 4
4
"dependencies" : {
5
5
"autoprefixer" : " ^6.3.3" ,
6
6
"browser-sync" : " ^2.11.1" ,
7
+ "crypto-md5" : " ^1.0.0" ,
7
8
"del" : " ^2.2.0" ,
8
9
"gulp" : " git://github.com/gulpjs/gulp#4.0" ,
9
10
"gulp-cssnano" : " ^2.1.1" ,
29
30
"lodash" : " ^4.5.1" ,
30
31
"postcss-pxtorem" : " ^3.3.1" ,
31
32
"posthtml-px2rem" : " ^0.0.3" ,
33
+ "quick-local-ip" : " ^1.0.7" ,
32
34
"rc" : " ^1.1.6" ,
33
35
"rd" : " ^0.0.2" ,
34
- "tmt-ejs-helper" : " ^0.0.1" ,
35
- "crypto-md5" : " ^1.0.0"
36
+ "tmt-ejs-helper" : " ^0.0.1"
36
37
},
37
38
"description" : " A f2e project workflow based on Gulp" ,
38
39
"repository" : {
57
58
},
58
59
"homepage" : " https://github.com/weixin/tmt-workflow" ,
59
60
"readmeFilename" : " README.md"
60
- }
61
+ }
You can’t perform that action at this time.
0 commit comments