1

https://developers.google.com/appengine/docs/python/config/appconfig#Python_app_yaml_Custom_PageSpeed_configuration

但是 combinejs 是行不通的

应用程序.yaml

pagespeed:
  domains_to_rewrite:
  - http://3.default.tagtooadex2.appspot.com
  url_blacklist:
  - http://ad.tagtoo.co/*
  - https://ad.tagtoo.co/*
  enabled_rewriters:
  - MinifyCss
  - CombineJs
  - CombineCss

原始 html

<!DOCTYPE html>
<html>
    <head>
    <meta charset="utf-8" />
            <title>index</title>
    </head>
    <body>
        <script src="/static/abc.js" ></script>
        <script src="/static/test.js" ></script>
        <link rel="stylesheet" type="text/css" href="/static/abc.css">
        <link rel="stylesheet" type="text/css" href="/static/test.css">
    </body>
</html>

页面速度

<!DOCTYPE html>
<html>
    <head><link rel="dns-prefetch" href="//1-ps.googleusercontent.com"><script type="text/psa_flush_style" id="zB4hUW-rUV"></script><script type="text/psa_flush_style" id="voam-hCNVZ"></script><script type='text/javascript'>window.mod_pagespeed_prefetch_start = Number(new Date());window.mod_pagespeed_num_resources_prefetched = 2</script>
        <meta charset="utf-8"/>
        <title>index</title>
    <script type='text/javascript'>window.mod_pagespeed_start = Number(new Date());</script></head>
    <body><noscript><meta HTTP-EQUIV="refresh" content="0;url='http://d.dashboard.myapp.appspot.com/static/index.html?ModPagespeed=noscript'" /><style><!--table,div,span,font,p{display:none} --></style><div style="display:block">Please click <a href="http://d.dashboard.myapp.appspot.com/static/index.html?ModPagespeed=noscript">here</a> if you are not redirected within a few seconds.</div></noscript>
            <script src="http://1-ps.googleusercontent.com/x/s.myapp.appspot.com/d.dashboard.myapp.appspot.com/static/abc.js.pagespeed.jm.8nvJlpa5Hg.js"></script>
            <script src="http://1-ps.googleusercontent.com/x/s.myapp.appspot.com/d.dashboard.myapp.appspot.com/static/test.js.pagespeed.jm.VK4YJf2N_A.js"></script>
            <script id="psa_flush_style_early" pagespeed_no_defer="">var applyFlushedCriticalCss=function(script_id,mediaString){var scripts=document.getElementsByTagName('script');var styleScript=document.getElementById(script_id);if(styleScript==null){return;}var cssText=styleScript.innerHTML||styleScript.textContent||styleScript.data||"";var styleElem=document.createElement('style');styleElem.type='text/css';if(styleElem.styleSheet){styleElem.styleSheet.cssText=cssText;}else{styleElem.appendChild(document.createTextNode(cssText));}if(mediaString){styleElem.setAttribute("media",mediaString);}var currentScript=scripts[scripts.length-1];currentScript.parentNode.insertBefore(styleElem,currentScript);};</script><script pagespeed_no_defer="">applyFlushedCriticalCss("zB4hUW-rUV","");</script>
            <script pagespeed_no_defer="">applyFlushedCriticalCss("voam-hCNVZ","");</script>
    <noscript class="psa_add_styles"><link rel="stylesheet" type="text/css" href="http://1-ps.googleusercontent.com/x/s.myapp.appspot.com/d.dashboard.myapp.appspot.com/static/abc.css.pagespeed.ce.2jmj7l5rSw.css"><link rel="stylesheet" type="text/css" href="http://1-ps.googleusercontent.com/x/s.myapp.appspot.com/d.dashboard.myapp.appspot.com/static/test.css.pagespeed.ce.2jmj7l5rSw.css"></noscript><script pagespeed_no_defer="">var stylesAdded=false;var addAllStyles=function(){if(stylesAdded)return;stylesAdded=true;var div=document.createElement("div");var styleText="";var styleElements=document.getElementsByClassName("psa_add_styles");for(var i=0;i<styleElements.length;++i){styleText+=styleElements[i].textContent||styleElements[i].innerHTML||styleElements[i].data||"";}div.innerHTML=styleText;document.body.appendChild(div);};if(window.addEventListener){document.addEventListener("DOMContentLoaded",addAllStyles,false);window.addEventListener("load",addAllStyles,false);}else if(window.attachEvent){window.attachEvent("onload",addAllStyles);}else{window.onload=addAllStyles;}window['pagespeed']=window['pagespeed']||{};window['pagespeed']['criticalCss']={'total_critical_inlined_size':0,'total_original_external_size':0,'total_overhead_size':0,'num_replaced_links':2,'num_unreplaced_links':0};</script><script pagespeed_no_defer="">(function(){var e=window,f=Math,g="round",h="performance",k="&rit_script=",r="&rit_link=",y="&rit_img=",z="&rit_css=",A="&nttfb=",B="&nfd=",C="&ndt=",D="&nct=",E="&nbt=",F="&mfd=",G="&attfb=",H="&afd=",I="&adt=",J="&act=",K="&abt=",L="";e.pagespeed=e.pagespeed||{};var M=e.pagespeed;
M.getResourceTimingData=function(){if(e[h]&&(e[h].getEntries||e[h].webkitGetEntries)){for(var s=0,t=0,l=0,u=0,m=0,v=0,n=0,w=0,p=0,x=0,q=0,c={},d=e[h].getEntries?e[h].getEntries():e[h].webkitGetEntries(),b=0;b<d.length;b++){var a=d[b].duration;0<a&&(s+=a,++l,t=f.max(t,a));a=d[b].connectEnd-d[b].connectStart;0<a&&(v+=a,++n);a=d[b].domainLookupEnd-d[b].domainLookupStart;0<a&&(u+=a,++m);a=d[b].initiatorType;c[a]?++c[a]:c[a]=1;a=d[b].requestStart-d[b].fetchStart;0<a&&(x+=a,++q);a=d[b].responseStart-d[b].requestStart;
0<a&&(w+=a,++p)}return H+(l?f[g](s/l):0)+B+l+F+f[g](t)+J+(n?f[g](v/n):0)+D+n+I+(m?f[g](u/m):0)+C+m+K+(q?f[g](x/q):0)+E+q+G+(p?f[g](w/p):0)+A+p+(c.css?z+c.css:L)+(c.link?r+c.link:L)+(c.script?k+c.script:L)+(c.img?y+c.img:L)}return L};M.getResourceTimingData=M.getResourceTimingData;})();
(function(){var c=encodeURIComponent,f=window,h="performance",k="unload:",l="on",m="load:",n="load",p="ets=",q="beforeunload",r="EventStart",s="?",t="=",u="&url=",v="&ttfb=",w="&req_start=",x="&ref=",y="&r",z="&nt=",A="&nrp=",B="&nav=",C="&ifr=1",D="&ifr=0",E="&htmlAt=",F="&fp=",G="&dwld=",H="&dom_c=",I="&dns=",J="&connect=",K="&ccul=",L="&ccrl=",M="&ccos=",N="&ccis=",O="&cces=",P="&b_csi=",Q="&",R="";f.pagespeed=f.pagespeed||{};var S=f.pagespeed,T=function(a,d,b,e){this.d=a;this.a=d;this.b=b;this.e=e};S.beaconUrl=R;
T.prototype.c=function(){var a=this.d,d=f.mod_pagespeed_start,b=Number(new Date)-d,a=a+(-1==a.indexOf(s)?s:Q),a=a+p+(this.a==n?m:k),a=a+b;if(this.a!=q||!f.mod_pagespeed_loaded){a+=y+this.a+t;if(f[h]){var b=f[h].timing,e=b.navigationStart,g=b.requestStart,a=a+(b[this.a+r]-e),a=a+(B+(b.fetchStart-e)),a=a+(I+(b.domainLookupEnd-b.domainLookupStart)),a=a+(J+(b.connectEnd-b.connectStart)),a=a+(w+(g-e)),a=a+(v+(b.responseStart-g)),a=a+(G+(b.responseEnd-b.responseStart)),a=a+(H+(b.domContentLoadedEventStart-
e));f[h].navigation&&(a+=z+f[h].navigation.type);e=-1;b.msFirstPaint?e=b.msFirstPaint:f.chrome&&f.chrome.loadTimes&&(e=Math.floor(1E3*f.chrome.loadTimes().firstPaintTime));e-=g;0<=e&&(a+=F+e)}else a+=b;S.getResourceTimingData&&f.parent==f&&(a+=S.getResourceTimingData());a+=f.parent!=f?C:D;this.a==n&&(f.mod_pagespeed_loaded=!0,(b=f.mod_pagespeed_num_resources_prefetched)&&(a+=A+b),(b=f.mod_pagespeed_prefetch_start)&&(a+=E+(d-b)));S.panelLoader&&(d=S.panelLoader.getCsiTimingsString(),d!=R&&(a+=P+d));
S.criticalCss&&(d=S.criticalCss,a+=N+d.total_critical_inlined_size+O+d.total_original_external_size+M+d.total_overhead_size+L+d.num_replaced_links+K+d.num_unreplaced_links);this.b!=R&&(a+=this.b);document.referrer&&(a+=x+c(document.referrer));a+=u+c(this.e);S.beaconUrl=a;(new Image).src=a}};S.f=function(a,d,b,e){var g=new T(a,d,b,e);f.addEventListener?f.addEventListener(d,function(){g.c()},!1):f.attachEvent(l+d,function(){g.c()})};S.addInstrumentationInit=S.f;})();

pagespeed.addInstrumentationInit('http://1-ps.googleusercontent.com/beacon?org=112_1_vo', 'load', '&s_ttfb=7&id=1390033300106483', 'http://d.dashboard.myapp.appspot.com/static/index.html');</script></body>
</html>

我在这里有什么遗漏吗?

4

1 回答 1

0
  pagespeed:
    disabled_rewriters:
    - FlushSubresources

google appengine pagespeed 禁用 FlushSubresources 工作选项

谷歌支持的这个答案

于 2014-03-09T13:06:29.183 回答