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

Xenforo.js is not compressed?

Renegade

Well-known member
#1
Page speed and other tools show that the xenforo.js file is not compressed. I have mod_deflate enabled and I think all pages and files are compressed except this.

Is there something I need to do specifically for this file?
 

Teapot

Well-known member
#3
Because of the way the XenForo JS is compressed, automated JS minifiers (and YSlow/Google Page Speed) report that it can be compressed further. Actually minifying the files further with default settings breaks the JS, though - I haven't yet found a way around that.
 

Chris D

XenForo developer
Staff member
#4
Compare it to the one in js/xenforo/full

Now tell me it's not compressed :)

Even if it can be compressed further, any further compression would be negligible.
 

digitalpoint

Well-known member
#5
Actually minifying the files further with default settings breaks the JS, though - I haven't yet found a way around that.
No it doesn't... I minified the default xenforo.js file and it cut about 4k out of the "already minified" version that comes with XenForo and doesn't break anything.

Try it yourself: https://tools.digitalpoint.com/javascript-compressor

Your file started as 130,426 bytes and ended as 126,285 bytes for a savings of 3.17%.
 

Renegade

Well-known member
#6
Code:
FAILED - (127.7 KB, compressed = 40.1 KB - savings of 87.6 KB) - http://www.techenclave.com/community/js/xenforo/xenforo.js?_v=3067a8be
Why is it that this warning doesn't come up when checking xenforo.com loading time.
http://www.webpagetest.org/result/130401_RS_A21/2/performance_optimization/#compress_text

But comes up when checking my forum
http://www.webpagetest.org/result/130401_7E_9X1/1/performance_optimization/#compress_text

Also how can I check the reason for First Byte time being so high for my forum as compared to that of XF.
 

Renegade

Well-known member
#7
Anyone has a clue why the following is appended at the end of the xenforo.js file? I think this is why it is not getting gzipped by the server.

?_v=3067a8be
 

Renegade

Well-known member
#9
I don't have cache enabled through the config file, nor do I have the minify enabled from acp. This particular JS file does not get flagged when do a speed test for xenforo. I do get it for cliptheapex with the exact same string. So doesn't look like unique to me.
 

shawn

Well-known member
#13
Any JS or CSS file should have a unique version identifier appended to it for cache compatibility. If you look at the source for an XF page, you'll find them on all JS and CSS files. CSS files use the 'd' variable (date in unixtime), but it's the same thing.
 

Hardcore

Active member
#15
I was having the same exact issue with Apache, but eventually found a solution.

I'm assuming you already have this in your config file:
Code:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
Add this before the end of the </IfModule>:
Code:
<LocationMatch "\.(css|js|x?html?|php)$">
  SetOutputFilter DEFLATE
</LocationMatch>
Restart and check again.

This worked for me, and others online who were having the same issue. Good luck.
 

Renegade

Well-known member
#16
Now I am a bit confused. I cannot find mod_deflate or mod_expires in any of the httpd.conf file or the .htaccess file on my server. But they both are enabled. :confused:
Where am I not looking?
 

Hardcore

Active member
#17
Now I am a bit confused. I cannot find mod_deflate or mod_expires in any of the httpd.conf file or the .htaccess file on my server. But they both are enabled. :confused:
Where am I not looking?
Simply loading the mod_deflate module doesn't activate it, but rather gives you access to using it.

For example, you'd need to add that code within one of your <VirtualHost> containers for whatever server XF is running on; that'll active mod_deflate for that specific server, using the above rules.