Authored by 徐炜

DNS 预读配置

module.exports = {
hosts: [
'//cdn.yoho.cn',
'//static.yohobuy.com',
'//img10.static.yhbimg.com',
'//img11.static.yhbimg.com',
'//img12.static.yhbimg.com',
'//img13.static.yhbimg.com',
'//analytics.m.yohobuy.com',
]
};
... ...
'use strict';
const fs = require('fs');
const dnsPrefetch = require('../../config/dns-prefetch');
let devHost = '127.0.0.1';
fs.readFile('.devhost', (err, buf)=> {
... ... @@ -12,7 +14,8 @@ fs.readFile('.devhost', (err, buf)=> {
module.exports = () => {
return (req, res, next) => {
Object.assign(res.locals, {
devHost: devHost
devHost: devHost,
dnsPrefetch: dnsPrefetch
});
next();
... ...
... ... @@ -10,10 +10,9 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta content="telephone=no" name="format-detection" />
<meta content="email=no" name="format-detection" />
<link rel="dns-prefetch" href="//cdn.yoho.cn">
<link rel="dns-prefetch" href="//static.yohobuy.com">
<link rel="dns-prefetch" href="//img12.static.yhbimg.com">
<link rel="dns-prefetch" href="//img13.static.yhbimg.com">
{{#dnsPrefetch.hosts}}
<link rel="dns-prefetch" href="{{this}}">
{{/dnsPrefetch.hosts}}
<script type="text/javascript">
var isWechat = /micromessenger/i.test(navigator.userAgent || '');
... ...