å
æ¥ãªãªã¼ã¹ããæãµã¼ãã¹ã® HTML ãè¦ã¦ããããå¤é¨ js ãã¡ã¤ã«ã®èªã¿è¾¼ã¿ã« ãåæ°è¡ããããã¨ä¸¦ãã§ããã®ãçºè¦ã
ããã確ã Apache module ã§ã¾ã¨ãã¦é
ä¿¡ãã¦ãããã®ããã£ãããªãâ¦â¦ã¨ãã¯ããæãèµ·ããã¦ãmod_concat ãè¦ã¤ããã®ã§è©¦ãã¦ã¿ãã
ã½ã¼ã¹ã³ã¼ãã®ã³ã¡ã³ãã«
* The Idea was initially thought of by David Davis in Vox, and reimplemented in perlbal.
ã¨ããããã«ããã¨ãã¨ã¯ Perlbal ãæã£ã¦ããæ©è½ã Apache module ã«ãããã®ã
svn ãããã§ãã¯ã¢ã¦ãã㦠apxs ã§ã³ã³ãã¤ã« & ã¤ã³ã¹ãã¼ã«ã
$ svn checkout http://modconcat.googlecode.com/svn/trunk/ modconcat-read-only # apxs -i -c modconcat-read-only/mod_concat/mod_concat.c
httpd.conf ã«è¨å®ã
LoadModule concat_module modules/mod_concat.so
ãã㧠path/to/??FILE1,FILE2,FILE3 ã®ããã«å¼ãã§ããã¨ãã«ã³ãã§åºåããããã¡ã¤ã«ããã¹ã¦é£çµããã¦åºåãããã"??" ããmod_concat ã§é ä¿¡ããåå³ã
å®éã®å¹æã Firebug ã§ã¿ãã¨ãããªæãã
concat ãªã
15ãªã¯ã¨ã¹ã㧠201 ms.
concat ãã
2ãªã¯ã¨ã¹ã㧠41 ms.
ãã¨ã¯éçºç¨ã«ãCatalyst::Plugin::Static::Simple ã§ãã®è¨æ³ãå¦çããæ©è½ãå¿
è¦ããã
TT ã§å¯¾å¦ãã§ãããã©ã
[% files = ['file1', 'file2', 'file3'] %] [% IF c.config.use_mod_concat %] <script src="[% c.uri_for('static') %]/??[% files.join(',') %]"></script> [% ELSE %] [% FOR f IN files %] <script src="[% c.uri_for('static', f) %]"></script> [% END %] [% END %]