Andy Huang
Well-known member
Currently, we have really neat CSS handling mechanism (css.php) which allow us to select multiple CSS files that we need to one single call. However, specific pages may require additional css or javascript, which goes beyond the initially defined package, and additional calls are added.
Suggestion: Introduce proxy.php and some basic javascript.
Each time a CSS is needed, template designer or addon developer "registers" a CSS link or JavaScript link with the system. Then, template system can grab all those and combine them into one single request, IE:
proxy.php looks at the css array, curl/or local lookup the files it doesn't know, combine the files in the order requested, gzip the package, store as a cache, and output the file. So long as the request string are the same (IE: version not changed), it just fetches from the cache.
Same thing can be done for javascripts.
This will reduce the HTTP request for main page by 3 (3 js requests vs 1 js request and 2 css requests vs 1 css request), and other subsequent pages by a various amount.
Suggestion: Introduce proxy.php and some basic javascript.
Each time a CSS is needed, template designer or addon developer "registers" a CSS link or JavaScript link with the system. Then, template system can grab all those and combine them into one single request, IE:
Code:
<link rel="stylesheet" type="text/css" href="proxy.php?css[]=css.php&#63;css=xenforo,form,public&amp;style=1&amp;d=1286902466&css[]=css.php&#63;css=attachment_editor,editor_ui&amp;style=1&amp;d=1286902466" />
proxy.php looks at the css array, curl/or local lookup the files it doesn't know, combine the files in the order requested, gzip the package, store as a cache, and output the file. So long as the request string are the same (IE: version not changed), it just fetches from the cache.
Same thing can be done for javascripts.
This will reduce the HTTP request for main page by 3 (3 js requests vs 1 js request and 2 css requests vs 1 css request), and other subsequent pages by a various amount.
Upvote
7