XF 2.2 Overriding the css_url function?

benFF

Well-known member
I want to deliver my css.php file via a CDN (pull domain, not CloudFlare), but it seems there is no config.php variable to set the CSS root URL. ($config['cssUrl'] or something like that)

The function css_url in templater.php doesn't have the code to add a URL prefix, so without hacking that file I can't see a way to add my CDN URL to the beginning.

I can manually insert it into the helper_js_global and font_awesome_setup templates, but this won't catch any CSS that is dynamically inserted (the second css.php file that xF uses on each page for example).

Or am I missing something very simple? :)

@Kirby - I saw you CDN cache your CSS file - did you need to make any modifications for that?

Thanks!
 
@Kirby - I saw you CDN cache your CSS file - did you need to make any modifications for that?
We do not use any CDN so I don't really know what you are talking about :)

That being said, I would recommend against loading CSS or fonts from a 3rd party host as this would most likely slow down FCP/LCP.
 
Ah sorry, I thought that this was the purpose of your post :)


My mistake!
 
Top Bottom