• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Lack of interest [Suggestion] Combine CSS.php, JS.php etc

#1
I think the files css.php, js.php, images.php and all the other files that does a similar function (ie delivering cachable static content ) should be combined in a more extensible file "static.php" or "cdn.php".

If im mistaken and this isn't the most efficient way of doing this then pardon my ignorance :)
 

Cezz

Well-known member
#2
I wouldn't personally combine them, I think it is great they are already covering most aspects IE all css is in css.php all js in js.php etc... combining them may become confusing.
 
#3
If they are doing it this way then it's probably for the best then :)

the rgb.php file is a pretty neat thing though :p

The reason i made this request was it seemed weird to make entire new files to perform such small functions.
 

Mike

XenForo developer
Staff member
#4
But they perform completely different tasks. I don't see any reason to combine them, nor any benefit.
 

welshstew

Active member
#6
you could combine and minify/gzip the outputs though - that would speed up the site.

i.e. only one css file, one JS file, etc

I think I counted about 11 JS files...

Most of these JS files could be moved to the end of the page too, no real need to have them in the head.
 

Cezz

Well-known member
#7
you could combine and minify/gzip the outputs though - that would speed up the site.

i.e. only one css file, one JS file, etc

I think I counted about 11 JS files...

Most of these JS files could be moved to the end of the page too, no real need to have them in the head.

I think this is planned... Looking at the HTML source you will see
HTML:
<!-
   <script type="text/javascript" src="js.php?js=js/jquery/jquery.tools.1-2-3.min.js,js/jquery/jquery.easing.1.3.js,js/jquery/jquery.hoverintent.minified.js"></script>
   <script type="text/javascript" src="js.php?js=js/foro/foro.js,js/foro/form.js"></script>

-->
Seems to me this will import all of the current JS files as two files instead.... Not currently in use though as it is commented out
 

Tigratrus

Well-known member
#9
If it's using css.php then the output isn't going to be cacheable? I'd prefer to see it rendered as a .css file, so that they can be cached on the local browser and served via a CDN. For sites with a global membership, being able to have cached versions of files served by geographically dispersed CDN servers can make a BIG difference. I'd rather that everyone didn't have to hit our server directly each time for such fundamental and reusable files.

Hrm... I suppose I need to look at it a bit more in firebug, most of the files seem to be static, is it just the css.php that's dynamic?
As long as gzip is enabled I'd imagine most of the .css and .js files would compress fine.
 

Kier

XenForo Developer
Staff member
#10
The CSS output from css.php is perfectly cacheable by any modern browser. We serve two separate css.php requests, one of which contains the CSS core that every page uses, while the second contains any CSS specifically requested by the page you are viewing. This allows the core to be cached regardless of what other CSS is requested.

As far as the Javascript is concerned, I've been working on merging a bunch of files - I should be able to roll that out here soon, which will hopefully give a nice speed-boost to everyone.
 

welshstew

Active member
#11
The CSS output from css.php is perfectly cacheable by any modern browser. We serve two separate css.php requests, one of which contains the CSS core that every page uses, while the second contains any CSS specifically requested by the page you are viewing. This allows the core to be cached regardless of what other CSS is requested.

As far as the Javascript is concerned, I've been working on merging a bunch of files - I should be able to roll that out here soon, which will hopefully give a nice speed-boost to everyone.
I think that deserves a - Whoop !
 

Tigratrus

Well-known member
#12
Thx Kier!
I was looking at the net tab in firebug and both the css.php requests were returning 304 not modified as you said.
Having a lot of the files combined will certainly make it a lot better for reducing the number of requests.

Might I suggest having a production option where the files are combined/minified and a debug option where the files are broken out and have all their comments in place to make debugging and screen layout tweaking easier? It's invaluable to be able to see everything when modifying things (as we all know). :)
 

Kier

XenForo Developer
Staff member
#13
I've just rolled out the merged JS and improved CSS here... you may well notice a significant speed boost to page-loads now.