ã¢ãã€ã«Webã®åºçŸã«ãããã€ã³ã¿ãŒãããã¯åã³æªããªããããã€ã¹ã¯é ããªããŸããã 3Gã4GãWi-Fi ...-ãã¡ããããããã¯ã©ããã«ãããŸãããå®éã«å¿ èŠãªå Žåã¯ãååãšããŠé床ãã¢ãã ã¢ãŒãã«è¿ããªãããStone Ageãã¢ãã€ã«ããã€ã¹ãçŸä»£ã®æ å ±éã®æ¡ä»¶ã«è©²åœããããšãããããŸãã åžå äžå¿éšïŒ15éïŒã§ããã¢ãã€ã«ã€ã³ã¿ãŒãããã¢ã€ã³ã³ã«éæ³ã®æåEã衚瀺ãããŠããå ŽåããããŸãã æ¯ååŸ æ©ããŠã¡ã¬ãã€ãåäœã§ã¢ããããŒãããŠçãã¡ãã»ãŒãžãéä¿¡ããããããäœããã®çš®é¡ã®WebãµãŒãã¹ã®ãã€ãã£ãããŒãžã§ã³ã䜿çšããæ¹ãé©åã§ãã WebãµãŒãã¹ã®ãã€ãã£ãããŒãžã§ã³...æ確ãªããžãã¹ããŒã±ãã£ã³ã°ãã¢ããªã±ãŒã·ã§ã³ã¬ãŒã¹ã ãã ãããŠãŒã¶ãŒã¯å®æçã«æŽæ°ããå¿ èŠããããŸãããããé«éã«å®è¡ããããã€ãã£ãWebã¢ããªã±ãŒã·ã§ã³ãéžæãã倧éã®ãªãœãŒã¹ãããŠã³ããŒãããŸããã
ãã®èšäºã§ã¯ãJavaScriptã®èªã¿èŸŒã¿ãšåæåãæé©åããæ¹æ³ã«ã€ããŠèª¬æããŸãã
ãã¹ãŠã®ã³ãŒãã䜿çšãããããã§ã¯ãããŸããã
ãŠãŒã¶ãŒã人æ°ã®ãããµã€ãã®ããŸããŸãªã¢ãã€ã«ããŒãžã§ã³ã®æåã®ããŒãžã«ã¢ã¯ã»ã¹ãããšãã«äœ¿çšãããã³ãŒãã®éãç¹å®ããããã«ãå°ã調æ»ãè¡ããŸããã ãã®ããã«ãChrome + script-coverãã©ã°ã€ã³ã䜿çšããŸããã
ç é¢ã®å¹³åã§ã¯ãã³ãŒãã®çŽ40ïŒ ã䜿çšããŠããŸãã ããŠã³ããŒããããªãœãŒã¹ã®80ïŒ ã䜿çšããŠãããµã€ãããããŸããã20ïŒ ãã䜿çšããŠããªããµã€ãããããŸãã ãæ®ãã¯ä»ã®ããŒãžã®ãã£ãã·ã¥ãã䜿çšãããŸãããšèšããšæ£ããã§ããã-éçºè ãšããŠãç§ãã¡ã¯ãªãå€ããããŒããããã®ããç¥ã£ãŠãããåçŽãªãŠãŒã¶ãŒã¯ã¡ãã»ãŒãžãéä¿¡ããã ãã§ãã®ããªã¥ãŒã ãããŒããããã®ãåŸ ã€ãã³ã«ãåéã«ã
ãã£ãã·ã¥
ãŠãŒã¶ãŒããã¹ãŠã®ãªãœãŒã¹ãäžåºŠããŠã³ããŒããããšããã£ãã·ã¥ããã次åããŠã³ããŒãããªããšä»®å®ããŸãïŒæå¹æéïŒFTW +300幎ïŒã
çŸåšããã¹ã¯ãããWebãã©ãŠã¶ã®ãã£ãã·ã¥ãµã€ãºã¯40ã80MBã§ãã ã»ãŒãã¹ãŠã®ãµã€ããExpiresã§ãã£ãã·ã¥ã«ã¯ããŒã«ããããšãæãã§ããããããã®éã¯ã¢ã¯ãã£ããªWebãµãŒãã£ã³ã®1æéåã§æµªè²»ãããå¯èœæ§ããããŸããåçããã®ä»ã®æªãããªãœãŒã¹ã300幎以äžäœ¿ãã䟿å©ãªã¹ã¯ãªãããæŒãåºããŸãã ããã¯äžçš®ã®å±±ã®çãŸãã¯ã€ã³ãã®åè»ã«ãªããŸãã 400 MBã®ãã£ã¹ã¯ãã£ãã·ã¥ããã蟌ãã§ããæ¯æ¥åãã¹ã¯ãªãããšã¹ã¿ã€ã«ã䜿çšã§ããŸãã
ã¢ãã€ã«ã§ã¯ããã¹ãŠãæªåããŸã-iOS Safariã«ã¯ãã£ã¹ã¯ãã£ãã·ã¥ããããŸããïŒã¡ã¢ãªå ã®ã¿ïŒãAndroidã§ã¯ã20 MBã«å¶éãããŠããŸãã
æé©åã¢ããª
ç°¡åãªã¢ããªã±ãŒã·ã§ã³ã1ã€äœæããŸãã-ããã¯ãã£ããã®ãããã¿ã€ãã§ãã ã€ã³ã¿ãŒãããã®7Kb / sã®é床ã§ãéåžžã«å³ããæ¡ä»¶ã§ããŠã³ããŒããé«éåããããšããŸãã ãã¹ãŠã®ããŒãžã§ã³ã¯ããã§èŠãããšãã§ããŸãazproduction.github.com/loader-test
é 次ããŒããšå®è¡
èµ·åæã«ãã¹ã¯ãªãããèªã¿èŸŒãã¢ããªã±ãŒã·ã§ã³ã³ãŒãã¯æ¬¡ã®ããã«ãªããŸãã
<script src="js/b-roster.js"></script> <script src="js/b-dialog.js"></script> <script src="js/b-talk.js"></script> <script src="js/index.js"></script>
ã¹ã¯ãªããã¯ã4ã€ã®ãªã¯ãšã¹ãã§ããŒããããé çªã«å®è¡ãããŸãïŒå®éãææ°ã®ãã©ãŠã¶ãŒã§ã¯ããã¯å°ãééã£ãŠããŸãïŒã ããã¯ããã¹ãŠã®ãªãã·ã§ã³ã®äžã§ææªã§ãã 圌ã®ãããã£ãŒã«ã¯æ¬¡ã®ããã«ãªããŸãã
18ç§...ãããªã«åŸ ããªãã§...
䞊åããŠã³ããŒããšå®è¡
ã¹ã¯ãªããã䞊è¡ããŠããŒãããã³éå§ãããããã«ã asyncå±æ§ãè¿œå ããŠã³ãŒãããããã«å€æŽããŸãã å€ãã®ã¢ããªã±ãŒã·ã§ã³ã§ã¯ããã®ããŠã³ããŒãæ¹æ³ã¯æ©èœããŸããã ã¹ã¯ãªããã¯ä»¥åã®ã³ãŒãã«äŸåããå ŽåããããŸãã
<script src="js/b-roster.js" async></script> <script src="js/b-dialog.js" async></script> <script src="js/b-talk.js" async></script> <script src="js/index.js" async></script>
äœãåŸããããèŠãŠã¿ãŸããã
äœãå€ãã£ãŠããŸãã... DOM readyã€ãã³ãã®ã¿ãå°ãæ©ãçºçããŸãããããã¯åœ¹ã«ç«ã¡ãŸããã ã¢ããªã±ãŒã·ã§ã³ãæ©èœããããã«ã¯ãã¹ãŠã®ã³ãŒããå¿ èŠã§ãã
䞊åããŒããé 次éå§
å¥ã®ãæé©åããé©çšããŠã¿ãŸããããåæã«ããŒãããŸãããé 次å®è¡ããŸãã ãããè¡ãã«ã¯ã LAB.jsã©ã€ãã©ãªã䜿çšããŸãã
<script type="text/javascript" src="vendors/LAB.min.js"></script> <script> $LAB .script("js/b-roster.js") .script("js/b-dialog.js") .script("js/b-talk.js") .wait() .script("js/index.js"); </script>
ãããŠããã¯æªåããã ãã§ãïŒ
䞊è¡ããŠããŒãããŠããããã«èŠããŸã-ããã¯ããªãœãŒã¹ã®ããŒãããããã¯ãããŠã¯ãªããããã¹ãŠãå°ãã§ãããããé«éã§ããããšãæå³ããŸãã
å®éãææ°ã®ãã©ãŠã¶ã¯ãã¹ãŠãããŒãžäžã®ãã¹ãŠã®ã¹ã¯ãªããã䞊è¡ããŠããŒãããŸãããããã¥ã¡ã³ãå ã®å®£èšã®é åºã§é çªã«å®è¡ããŸãã ã¹ã¯ãªãããå¿ èŠä»¥äžã«æ©ãå°çãããšããã®èµ·åã¯ãããã¯ãããŸãã LAB.jsã®å ŽåãLAB.jsã¹ã¯ãªããã¯ä»ã®ãã¹ãŠã®ã¹ã¯ãªããã®ããŒãããããã¯ããããã«ã¯ããçšåºŠã®ããªã¥ãŒã ãå¿ èŠãšãããšããäºå®ã«ãããããããå®éã«ã¯ãã©ãŠã¶ãŒã®äœæ¥ãè¡ããŸãã
éããŠæ¢±å
å¥ã®ããªãæçœãªæé©åãé©çšããŸããã-ãã¹ãŠã®ã¹ã¯ãªããã1ã€ã®ãã¡ã€ã«ã«åéãããã®ã³ãŒããäœããã®ãããã¡ã€ã€ã§å§çž®ããŸãã
$ cat **/*.js > main.js $ java -jar yuicompressor.jar main.js -o main.min.js
ãããã®è¡ã¯å€ãã®äººã«éŠŽæã¿ããããšæããŸããYUICompressorã䜿çšããŸããã UglifyJsãŸãã¯Closure Compilerã䜿çšããããšããå§ãããŸãã
ãã®æé©åã®çµæã¯éåžžã«æçœã§ãã ååãšããŠããã以äžæé©åããªãããšãå¯èœã§ã:)ãããïŒ 9s ...-æ¯ååŸ æ©ãããŠãŒã¶ãŒã¯éåžžã«å€ããããŸããã
AppCache-ãªãã©ã€ã³ã¹ãã¬ãŒãž
äžè¬çãªãã£ãã·ã¥ãšã¯ç°ãªããããã¯åã¢ããªã±ãŒã·ã§ã³ã®å人çšã§ãããä»ã®ã¢ããªã±ãŒã·ã§ã³ã¯ãã®ãªãœãŒã¹ãæŒãã€ã¶ãããšã¯ã§ããŸããã çºçããå¯èœæ§ãããã®ã¯ãAppCacheã®åèšã¯ã©ãŒã¿ãçµäºãããããŠãŒã¶ãŒãã¯ãªã¢ããããšã ãã§ãã AppCacheã¯å€ãã®ãã©ãŠã¶ã§ãµããŒããããŠããŸã ã ãªãã©ã€ã³ã¹ãã¬ãŒãžãšåŒã°ããŸããããã®ãªãœãŒã¹ã䜿çšããŠãªã³ã©ã€ã³ã§äœæ¥ã§ããŸãã
æ¥ç¶ã¯ãšãŠãç°¡åã§ãïŒ
ãããã§ã¹ãå±æ§ãappcacheãã¡ã€ã«ãžã®ãªã³ã¯ã«ç»é²ããã ãã§ååã§ã
<html manifest="example.appcache"> </html>
ãã£ãã·ã¥ã«ç§»åãããã¹ãŠã®ãªãœãŒã¹ããªã¹ããããã®ãã¡ã€ã«ãäœæããŸãïŒããã¯ãã¡ã€ã«ã®æãåçŽãªããŒãžã§ã³ã§ãïŒ
CACHE MANIFEST # v1 - 2011-08-13 http://example.com/index.html http://example.com/main.js
ãŸããWebãµãŒããŒã®èšå®ã§ããã¡ã€ã«ãæ£ããMIMEã¿ã€ãã§è¿ããããã£ãã·ã¥ãããªãããã«ãæ°è¡ãèšè¿°ããŸã
AddType text/cache-manifest .appcache ExpiresByType text/cache-manifest "access plus 0 seconds"
AppCacheã䜿çšãããšãã¢ããªã±ãŒã·ã§ã³ãæéåãã§ããããšããŠãŒã¶ãŒã«è¿ éã«ïŒäžå¿ èŠãªæŸèæãªãã§ïŒéç¥ããããŒãžã®ãªããŒããèŠæ±ãããããªããŒãã®è§£æ±ºãèŠæ±ã§ããŸãã ãã©ãŠã¶ã¯ããã¹ãŠã®ãããã¯ãŒã¯ã¢ã¯ãã£ããã£ãååŸãããã£ãã·ã¥ããã§ãã¯ããŸããupdatereadyã€ãã³ãã«ãµãã¹ã¯ã©ã€ããããã£ãã·ã¥ã®ã¹ããŒã¿ã¹ããã§ãã¯ããã ãã§ãã
if (window.applicationCache) { applicationCache.addEventListener('updateready', function() { if (confirm('An update is available. Reload now?')) { window.location.reload(); } }); // if(window.applicationCache.status === window.applicationCache.UPDATEREADY) { if (confirm('An update is available. Reload now?')) { window.location.reload(); } } }
AppCacheã®é·æ
1.ä¿¡é Œã§ãããã£ãã·ã³ã°
2.ãªãã©ã€ã³ã§äœæ¥ãã
3.ã·ã³ãã«ãªããŒãžã§ã³ç®¡ç
4.ã¿ã€ã ãªãŒãªæŽæ°
AppCacheã®çæ
1.ãã£ã¹ã¯ã¯ã©ãŒã¿ãçµäºããå ŽåããããŸã
2.ãŠãŒã¶ãŒããµã€ãã§ãã£ãã·ã¥ã䜿çšããããšãèš±å¯ããŠããªãå¯èœæ§ããããŸãïŒFirefoxã®å ŽåïŒ
3.
NETWORK:\n*
ç»é²ãããŠããªãå Žåããã£ãã·ã¥ãããããŒãžã§ãªã³ã©ã€ã³ãªãœãŒã¹ãå©çšã§ããŸãã
NETWORK:\n*
4. .appcacheãã¡ã€ã«ã«Expires +300幎ãçªç¶è¿œå ãããšããŠãŒã¶ãŒã¯å€ãããŒãžã§ã³ã«å®å šã«åºå®ãããŸãã
5.ä»ã®ãã¡ã€ã³ãžã®ãªãã€ã¬ã¯ãã¯å€±æãšããŠèªèãããŸã
AppCacheã®ããã€ãã®ãã€ãã¹ç¹www.alistapart.com/articles/application-cache-is-a-douchebag
VitaZheltyakovããããã€ãã®ã³ã¡ã³ããæ¿å ¥ãããŠãã ããã圌ã«æè¬ããŸãã
-FFã§æ§æãããæšæºãã£ãã·ã¥ã䜿çšããŠãã¢ããªã±ãŒã·ã§ã³ãã£ãã·ã¥ã®ãã¡ã€ã«ãæŽæ°ããŸãã -ãã¡ã€ã«ã¯æŽæ°ãããŸããã
-NETWORKããã³FALLBACKã»ã¯ã·ã§ã³ã«ç¹å®ã®ãªã³ã¯ïŒãã¿ãŒã³ã§ã¯ãªãïŒãå ¥ããŸã-æå®ãããŠããªããã¡ã€ã«ã¯ãã¹ãŠããŠã³ããŒããããŸããã
-ãã¬ãŒã ã§ãæåã«ã¢ããªã±ãŒã·ã§ã³ãã£ãã·ã¥ãã£ãã·ã³ã°ã䜿çšããŠããŒãžãéããŸã-ã¢ããªã±ãŒã·ã§ã³ã¯ããªãŒãºããããŒãžãåšæçã«èªã¿èŸŒã¿ãŸãã
-ãããã§ã¹ãã宣èšãããŠããã¡ã€ã³ããŒãžã®ãªãã©ã€ã³ã³ããŒã䜿çšããŠã¿ãŠãã ãã-ãã£ãã·ã¥ããäœæ¥ããŒãžãšããŠããŒããããŸãã
ãã£ãã·ã¥ããã¢ããªã±ãŒã·ã§ã³ããªããŒããããšã©ã®ãããªçµæãåŸããããã¯éåžžã«æçœã ãšæããŸã-0ãªã¯ãšã¹ãã0ãã€ãã ïŒ.appcacheãã¡ã€ã«ã®ããŠã³ããŒãã«ã¯1ã€ã®èŠæ±ãå¿ èŠã«ãªãå ŽåããããŸãïŒ
AppCacheã®è©³çŽ°
MDN tinyurl.com/mdn-appcacheã® AppCacheã«é¢ããèšäº
AppCacheã®ãããã質åappcachefacts.info
åå¿è åãAppCache www.html5rocks.com/en/tutorials/appcache/beginner
éžæçããŠã³ããŒã
çŸåšããã£ãã·ã¥ã¯è¯å¥œã§ãããã¢ããªã±ãŒã·ã§ã³ã®èªã¿èŸŒã¿ã¯æé©ãšã¯ã»ã©é ãç¶æ ã§ãã çŸåšããŠãŒã¶ãŒãå¿ èŠãšããªããããããªãè¿œå ã®ãªãœãŒã¹ãããŒãããŠããŸãã é 延èªã¿èŸŒã¿ã¹ã¯ãªããã§æé©åãé©çšããŸãã AMDã® ããã¿ãŒã³ã-éåæã¢ãžã¥ãŒã«å®çŸ©ãšããã®APIãå®è£ ããRequireJSã©ã€ãã©ãªã䜿çšã§ããŸã
1.äž»èŠéšåãåºè·ãã
2.å¿ èŠã«å¿ããŠæ®ã
3.èªåäŸåé¢ä¿ããŒã
4. ...
5.å©ç
ã¢ããªã±ãŒã·ã§ã³ã2ã€ã®éšåã«åå²ã§ããŸããããã¯ãé£çµ¡å ã®ãªã¹ããšãã€ã¢ãã°ãå«ãåç°¿ã§ãã åç°¿ã¯åžžã«è¡šç€ºãããå¿ èŠãããããã€ã¢ãã°ãéãé »åºŠã¯äœããªããããå¿ èŠã«å¿ããŠããŒãããŸãã
ç§ãã¡ã®htmlã¯ãã®ããã«ãªããŸãã
<script data-main="js/amd/index" src="vendors/require.js"></script>
require.jsã«å¿ èŠãªã©ãããŒã§åã¢ãžã¥ãŒã«ãã©ããããŸããã index.jsã®å Žåã次ã®ããã«ãªããŸãã
require(["b-roster"], function(Roster) { new Roster($('body')); });
ãããŠãåããŒãå¯èœã¢ãžã¥ãŒã«ãå¥ã®ã©ãããŒã§ã©ããããŸãã
define(function () { // - return ModuleName; });
èµ·åæã«ã¯ãindex.jsãšroster.jsã®ã¿ãããŒãããrosterèŠçŽ ãã¯ãªãã¯ããŠãæ®ãã®ãã¡ã€ã«ãããŒãããŸãã
querySelector('.b-roster').addEventListener('click', function (e) { require(["b-dialog"], function(Dialog) { new Dialog(element); }); }, false);
ã¢ã€ãã¢ãšå®è£ ã¯ç°¡åã§ããçµæãšããŠåŸããããã®ãèŠãŠã¿ãŸãããã
åã®çµæãšæ¯èŒããŠãããã«2ã€ã®ãªã¯ãšã¹ããè¡ãããã«ãªããŸããããã¹ã¯ãªããã®åæããªã¥ãŒã ã¯16.5 KBãæéã¯2.1ç§æžå°ããŸãã
ãã¡ããããã®ã¢ãããŒãã«ã¯1ã€ã®éèŠãªãã€ãã¹ç¹ããããŸã-ãŠãŒã¶ãŒã¯4ç§åŸ ã£ãŠããåç°¿èŠçŽ ãã¯ãªãã¯ããå¿ èŠãããããïŒæ®ãã®ã¹ã¯ãªãããèªã¿èŸŒãŸããŸãïŒãããã¯ãã¡ããããŸãè¯ããããŸããã
é 延èªã¿èŸŒã¿ãšåæå
èµ·åæã®7.4ç§-ãã¡ãããããã¯18ç§ã§ã¯ãªãããŠãŒã¶ãŒã蚱容ã§ãã3ã5ç§ã§ã¯ãããŸããã
ã¹ã¯ãªããã®éãå¢å ãããšãã¢ããªã±ãŒã·ã§ã³ã®èµ·åæéã§ããã¹ã¿ãŒãã¢ããã¬ã€ãã³ã·ãå¢å ããŸãã å®éã®ãšãããèµ·åæã«ããã©ãŠã¶ã¯ãã®ãã¡ã€ã«ã«ãªã¹ããããŠãããã¹ãŠã®é¢æ°ããªããžã§ã¯ããã³ã³ã¹ãã©ã¯ã¿ãŒã解éããåæåããå¿ èŠããããŸãïŒçŸæç¹ã§ã¯å¿ èŠãããŸããïŒã ãŸãããã©ãŠã¶ãšããã€ã¹ã®ãªãœãŒã¹ã®è² è·ã«å¿ããŠãã·ã£ããã«ãããJavaScriptã®1MBã®åæåæéã¯æ倧3ç§ã«éããå¯èœæ§ããããŸãã ãã¡ããããã¹ã¯ããããã©ãŠã¶ãŒã®å Žåããã®æ°å€ã¯ã¯ããã«äœããªããŸãïŒ100ã300ããªç§ïŒã
ã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ãããšããã¹ã¯ãªãããæååã«å€æããå¿ èŠã«å¿ããŠããããããããããŠã³ãŒããååŸã§ããŸãã ã¯ããevalã¯éåžžã®èµ·åãããé ããªããŸããããã®åæåã¯èµ·åæã«ã¯çºçããŸããããã¢ããªã±ãŒã·ã§ã³ã®å®è¡æã«çºçãããããã¢ããªã±ãŒã·ã§ã³ã®èµ·åãéããªããŸãã
Lmd
ãã®èãã«åºã¥ããŠã LMDã®åå-é 延ã¢ãžã¥ãŒã«å®£èšãäœæããåãååã®å¥ã®ãããŒãããŒããŒããäœæããŸããã é 延åæåã«å ããŠãLMDã«ã¯ä»ãšæ¯èŒããŠå€ãã®å©ç¹ããããŸãã
2. Node.jsã®ãããªã¢ãžã¥ãŒã«
AMDã¯ãæ¯ådefineïŒïŒãèšè¿°ããå¿ èŠããããŸãããNode.jsã®å Žåã¯ãã©ãããŒããšã¯ã¹ããŒãã䜿çšããããžãã¯ãªãã§ã1 in 1ãã©ãŠã¶ãŒã®ã³ãŒããå®çŸ©ããã³èšè¿°ããã«è¡ãããšãã§ããŸãã
ããã¯ãindex.jsã³ãŒããLMDã§ã©ã®ããã«èŠãããã§ãã
var $ = require().$, // require("undefined") Roster = require("b-roster"); new Roster($('body'));
LMDããã±ãŒãžãã¢ã»ã³ãã«ãããšããLMDèªäœã¯ãã§ã«ãã®ã³ãŒããå¿ èŠãªã©ãããŒã§ã©ããããŠããŸãã
3.çµã¿èŸŒã¿ã®ã³ã¬ã¯ã¿ãŒããã³ããã«ãŒ
LMDã«ã¯ããã§ã«ã¹ã¯ãªããã®ã³ã¬ã¯ã¿ãŒãšããã«ãŒãçµã¿èŸŒãŸããŠããŸãã ããã±ãŒãžã«å«ããå¿ èŠããããã¹ãŠã®ã¹ã¯ãªããã宣èšããå¿ èŠããããŸãã
{ "path": "./modules/", "modules": { "main": "index.js", "b-roster": "b-roster.js", "undefined": "utils.js", // * "*": "*.js" } }
LMDã¯ããããå§çž®ããã³ããã¯ããŸãããå§çž®ãšããã±ãŒãžã³ã°ã¯ââãªãã·ã§ã³ã§ãããã¡ã€ã«å šäœãŸãã¯ã¢ãžã¥ãŒã«ããšã«åå¥ã«ç®¡çã§ããŸãã
4.æè»ãªã©ã€ãã©ãªãµã€ãº
Require.js-AMDãšã¯ç°ãªãããã¹ãŠã®LMDã³ãŒãã¯ãäžå¿ èŠãªãžã§ã¹ãã£ãŒãªãã§ãã¢ã»ã³ããªæã«ã¹ã¯ãªããããã±ãŒãžã«å«ãŸããŠããŸãã ããããçš®é¡ã®æé©åãšããã©ã°ã€ã³ããæè»ã«æå¹ãŸãã¯ç¡å¹ã«ã§ããŸãã ããšãã°ãã³ãŒããææ°ã®ã¢ãã€ã«ããã€ã¹ã§ã®ã¿æ©èœããå ŽåãIE6ã§ããããã¹ãŠã®ããã¯ãå¿ èŠãªã®ã¯ãªãã§ããïŒïŒ LMDã§ã¯ããã®ãæé©åããèšå®ã§ç°¡åã«ç¡å¹ã«ã§ããŸãã ãŸãã¯ãCSSãåçã«ããŒãããããªã-ãªãäœåãªã³ãŒãããã©ãã°ããå¿ èŠãããã®ã§ããïŒïŒ -ãªãã·ã§ã³ãç¡å¹ã«ãããšãã³ãŒããå°ãããªããŸãã LMD.jsã®æå°ãµã€ãºã¯288ãã€ãã®ã¿ã§ãã
5.ããããã«ããããžã§ã¯ã
äœãèµ·ãã£ãã®ãã確èªããããã«æ¯ååæ§ç¯ããå¿ èŠããããããªWebã¢ããªã±ãŒã·ã§ã³ããããŸãã LMDãããã«æ©ãŸãããŸãããæ¯åãµãŒããŒäžã§ããªãããŒãªãã«ãã
make
ãŸãã¯èª¿æŽããããšã匷å¶ããŸããã ç£èŠã¢ãŒãã§LMDãèµ·åããã ãã§ãã¢ã»ã³ããªã«å«ãŸãããã¡ã€ã«ãå€æŽãããã³ã«ãLMDã¯ãããžã§ã¯ãå šäœãåæ§ç¯ããŸãã
$ lmd watch config.lmd.json output.js
6.ã¹ããŒãã³ã¬ã¯ã¿ãŒ
ã¢ã»ã³ããªäžã«çºçããå¯èœæ§ã®ãããšã©ãŒãææã§ããLMD.jsããã¹ããŒãã³ã¬ã¯ã¿ãŒãäœæããããšããŠããŸã-ParseErrorãèšå®ã®æ¬ èœ/è¿œå ãã©ã°ãé 延ã¢ãžã¥ãŒã«ã§ã®ã°ããŒãã«ã®çŽæ¥äœ¿çšãããã³ãã®ä»ã®æé©åã
ããããã®ãã©ã¹ããããŸãããå®éã«ã¯äœãïŒ
AMDãšæ¯èŒããŠãããªã¥ãŒã ãããã«13.5 Kbãéå§æéã2.1ç§ããªã¯ãšã¹ãæ°ã2æžãããŸããã
æåã®ã±ãŒã¹ãšæ¯èŒãããšãé©ãã¹ãçµæãåŸãããŸãã
ãããã«
1. AppCacheã䜿çšããŸããã泚æããŠãã ãã
AppCacheã¯ããªãåçŽãªæé©åã§ããããããžã§ã¯ãã³ãŒããå€æŽããããšãªããWebã¢ããªã±ãŒã·ã§ã³ã«é©åãªãã£ãã·ã¥ãè¿œå ããŸãã AppCacheã«ã¯å€ãã®åé¡ããããŸãã ã¢ããªã±ãŒã·ã§ã³ãã£ãã·ã¥ã¯Douchebagã§ãã ãªãœãŒã¹ã®ãªã¹ããåéããããã¹ã¯ãªãããèšè¿°ãããããã®ãé¢åãªå Žåã¯ãConfess tinyurl.com/confessjsããŒã«ã䜿çšã§ããŸãã
2.ã¹ã¯ãªãããåéãã
ã¹ã¯ãªããããŸã å§çž®ããŠããªãå Žåãããã¯æãè²»çšå¯Ÿå¹æã®é«ãæé©åã§ã-èªã¿åããåæ¢ããŠãæçµçã«makeãã¡ã€ã«ãæžã蟌ã¿ãŸã:)
3. LMDãŸãã¯AMDã®äœ¿çšãéå§ãã
æ¢åã®ã¢ããªã±ãŒã·ã§ã³ãLMDãŸãã¯AMDã«å€æããããšã¯éåžžã«å°é£ã§ãããæžãå§ãããšããŠãŒã¶ãŒãšéçºè ã®äž¡æ¹ã«ãšã£ãŠãããè¡ãã®ã¯ç°¡åã§æçã§ãã é 延èªã¿èŸŒã¿ã«å ããŠãå®å šã«åé¢ãããã¢ãžã¥ãŒã«ãååŸããŸããããã¯ãããŒã ã¯ãŒã¯ã§éåžžã«æçã§ãã
ãã¹ãŠã®ãªã³ã¯
æé©åããã¢ããªã±ãŒã·ã§ã³azproduction.github.com/loader-test
ããŒã«ãšã¹ã¯ãªãã
LMD github.com/azproduction/lmd
tinyurl.com/confessjsãåçœãã
Require.js requirejs.org
YUIã³ã³ãã¬ããµãŒtinyurl.com/yui-compressor
caniuse.comã䜿çšã§ããŸãã
script-cover code.google.com/p/script-cover
UglifyJS github.com/mishoo/UglifyJS
losureompilercode.google.com/ p /closure- compiler
AppCacheã«ãã
MDN tinyurl.com/mdn-appcacheã® AppCacheã«é¢ããèšäº
AppCacheã®ãããã質åappcachefacts.info
åå¿è åãAppCache www.html5rocks.com/en/tutorials/appcache/beginner
AppCacheã®åé¡ã«é¢ããèšäºwww.alistapart.com/articles/application-cache-is-a-douchebag
PSããã¯ãDUMP 2012ã§ã®ç§ã®ã¬ããŒãã®æ¡åŒµçã§ã
UPD AppCacheã®åé¡ãè¿œå ãããŸãããyeremeievãšVitaZheltyakovã«åœ¹ç«ã€ãªã³ã¯ãšãã³ããããããšãã