Showing
3 changed files
with
19 additions
and
5 deletions
config/dns-prefetch.js
0 → 100644
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | const fs = require('fs'); | 3 | const fs = require('fs'); |
4 | +const dnsPrefetch = require('../../config/dns-prefetch'); | ||
5 | + | ||
4 | let devHost = '127.0.0.1'; | 6 | let devHost = '127.0.0.1'; |
5 | 7 | ||
6 | fs.readFile('.devhost', (err, buf)=> { | 8 | fs.readFile('.devhost', (err, buf)=> { |
@@ -12,7 +14,8 @@ fs.readFile('.devhost', (err, buf)=> { | @@ -12,7 +14,8 @@ fs.readFile('.devhost', (err, buf)=> { | ||
12 | module.exports = () => { | 14 | module.exports = () => { |
13 | return (req, res, next) => { | 15 | return (req, res, next) => { |
14 | Object.assign(res.locals, { | 16 | Object.assign(res.locals, { |
15 | - devHost: devHost | 17 | + devHost: devHost, |
18 | + dnsPrefetch: dnsPrefetch | ||
16 | }); | 19 | }); |
17 | 20 | ||
18 | next(); | 21 | next(); |
@@ -10,10 +10,9 @@ | @@ -10,10 +10,9 @@ | ||
10 | <meta name="apple-mobile-web-app-status-bar-style" content="black" /> | 10 | <meta name="apple-mobile-web-app-status-bar-style" content="black" /> |
11 | <meta content="telephone=no" name="format-detection" /> | 11 | <meta content="telephone=no" name="format-detection" /> |
12 | <meta content="email=no" name="format-detection" /> | 12 | <meta content="email=no" name="format-detection" /> |
13 | - <link rel="dns-prefetch" href="//cdn.yoho.cn"> | ||
14 | - <link rel="dns-prefetch" href="//static.yohobuy.com"> | ||
15 | - <link rel="dns-prefetch" href="//img12.static.yhbimg.com"> | ||
16 | - <link rel="dns-prefetch" href="//img13.static.yhbimg.com"> | 13 | + {{#dnsPrefetch.hosts}} |
14 | + <link rel="dns-prefetch" href="{{this}}"> | ||
15 | + {{/dnsPrefetch.hosts}} | ||
17 | 16 | ||
18 | <script type="text/javascript"> | 17 | <script type="text/javascript"> |
19 | var isWechat = /micromessenger/i.test(navigator.userAgent || ''); | 18 | var isWechat = /micromessenger/i.test(navigator.userAgent || ''); |
-
Please register or login to post a comment