vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=301109

css @import to <link>
by PinkMilk
13 Aug 2013 03:37

when storing style sheets to file vBulletin uses @import:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

this has a negative impact on web page performance, is it some how possible to change this to link?

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


--- Update ---


I have found this in includes/adminfunctions_template.php which looks to be the code I need to edit:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

BUT

there is also this function that deletes the older css files:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

so would need to change the preg_match regex for it to work with <link>, bit of an ask but can somebody be kind enough to rewrite the function?

Zachery 13 Aug 2013 05:08

Uh, that is php code, not css code. I'm nearly positive vBulletin doesn't use an @import in the actual css rules. It uses a standard <link> tag, in the head.

PinkMilk 13 Aug 2013 05:51

Quote:

Originally Posted by Zachery (Post 2438570)
Uh, that is php code, not css code. I'm nearly positive vBulletin doesn't use an @import in the actual css rules. It uses a standard <link> tag, in the head.

Under the vbulletin options > Style & Language Settings there is an option:
"Store CSS Stylesheets as Files?", if you check yes instead of the full css loading in page (see this sites source for example) you get something like this:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

as you can see it uses @import, this is not the best option it is better to use <link> as explained in op.

The first php code snippet is what helps create this , each time you update your style a new css file is created and the function in op deletes the older stored css file.

kh99 13 Aug 2013 10:42

Try replacing the preg line with:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.



Quote:

Originally Posted by Zachery (Post 2438570)
Uh, that is php code, not css code. I'm nearly positive vBulletin doesn't use an @import in the actual css rules. It uses a standard <link> tag, in the head.

I thought the same thing, but it turns out it is something that browsers recognize. http://stackoverflow.com/questions/1...why-use-import

PinkMilk 13 Aug 2013 15:36

Quote:

Originally Posted by kh99 (Post 2438612)
Try replacing the preg line with:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I thought the same thing, but it turns out it is something that browsers recognize. http://stackoverflow.com/questions/1...why-use-import

Thanks but didn't work, I have the <link> format working great its just the deleting of the older stylesheet, guess I will have to just remember to clean that folder out from time to time.

kh99 13 Aug 2013 15:54

Quote:

Originally Posted by PinkMilk (Post 2438656)
Thanks but didn't work, I have the <link> format working great its just the deleting of the older stylesheet, guess I will have to just remember to clean that folder out from time to time.


Oh right - I got the pattern to match but forgot that it needs parens around the matched part to use in the unlink call. If you want to try again, you could try this:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


PinkMilk 13 Aug 2013 16:12

Also didn't work but I moved clientscript/vbulletin_css/ from unlink into preg match and is now.

kh99 13 Aug 2013 16:13

I was just wondering if your <link> tag had the path in the file name or not. I guess it does.


All times are GMT. The time now is 02:12.

Powered by vBulletin® Version 3.8.14
Copyright © 2021, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.