1. 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

Discussion in 'Closed Suggestions' started by Brandon_R, Aug 1, 2010.

  1. Brandon_R

    Brandon_R Guest

    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 :)
  2. Cezz

    Cezz Well-Known Member

    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.
    RockCake likes this.
  3. Brandon_R

    Brandon_R Guest

    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.
  4. Mike

    Mike XenForo Developer Staff Member

    But they perform completely different tasks. I don't see any reason to combine them, nor any benefit.
  5. Cezz

    Cezz Well-Known Member

    Beat me to it... Just what I was going to say they are small tasks but still they are completely separate tasks.
  6. welshstew

    welshstew Active Member

    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.
    gordy likes this.
  7. Cezz

    Cezz Well-Known Member

    I think this is planned... Looking at the HTML source you will see
       <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
  8. welshstew

    welshstew Active Member

    makes sense for bug busting
  9. Tigratrus

    Tigratrus Well-Known Member

    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.
  10. Kier

    Kier XenForo Developer Staff Member

    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.
    Ceri May likes this.
  11. welshstew

    welshstew Active Member

    I think that deserves a - Whoop !
  12. Tigratrus

    Tigratrus Well-Known Member

    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). :)
  13. Kier

    Kier XenForo Developer Staff Member

    I've just rolled out the merged JS and improved CSS here... you may well notice a significant speed boost to page-loads now.
  14. Tigratrus

    Tigratrus Well-Known Member

    I think we dropped three or four requests per page? :)

    :: thumbs up ::
  15. Cezz

    Cezz Well-Known Member

    I am seeing the merged CSS calls but the JS are not merged. Did you revert the change?
  16. Derek Ivey

    Derek Ivey Member

    Seems faster! Nice job Kier!
  17. Brandon_R

    Brandon_R Guest

    Holy Crap dude the forum loads in under 1 second on the HOME PAGE.
    Kier likes this.
  18. Kier

    Kier XenForo Developer Staff Member

    Thought you might like that :)

    This is also the busiest time of day for http://forums.spacebattles.com, (one of my 5m post vBulletin forums, which is also on this server) so we are competing for resources with them - I think we are doing rather well!
    Derek Ivey and Ceri May like this.
  19. Eric

    Eric Active Member

    It seems a lot of the javascript has been rolled up into: js/jquery/jquery.xenforo.rollup.js

Share This Page