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

Lack of Interest Allow an external URL for css as well

Discussion in 'Closed Suggestions' started by Ketola, Sep 19, 2013.

  1. Ketola

    Ketola Member

    I suggest a config option $config['cssUrl']. This could be used to load css.php through a CDN service, which in turn would use the XenForo install as it's backend.

    This would allow CSS, like JavaScript and data, to be cached and served by a CDN for speedy delivery.
    tajhay, Liam W, Marcus and 1 other person like this.
  2. Rigel Kentaurus

    Rigel Kentaurus Well-Known Member

    I tried it, and sadly... The issue is that the CSS can have conditionals, and those can be per user...
    And that makes it uncacheable
  3. Ketola

    Ketola Member

    Well that's a true pitfall indeed. A very odd design decision.

    Quickly looking at the base CSS files that are always included (xenforo,form,public) and I couldn't find anything user specific in those or the CSS files they include, so at least those can be served from CDN.

    In fact I have edited the PAGE_CONTAINER to include the css.php?css=xenforo,form,public CSS through CDN, and everything seems to work as expected.
  4. Rigel Kentaurus

    Rigel Kentaurus Well-Known Member

    I think it might not be that bad actually ...
    Even thought there is a *potential* for it to be used, it does not seem to be exploited currently, I did a quick

    select title,template from xf_template where title like '%.css' and template like '%\$visitor%';
    And that returned 0 rows, which means the visitor is not being inspected for custom styles.

    A different story is with xen:if

    select title,template from xf_template where title like '%.css' and template like '%xen\:if%';
    57 rows returned
    However, must of them are something like
    <xen:if is="{xen: property enableResponsive}">

    And since that is NOT user configurable but in the style itself, it would always return the same value.

    I liked your first post, I think this should be an option in the same way we can localize external data through a CDN.

    May I ask which CDN you are using?
  5. Ketola

    Ketola Member

    That's pretty much what I found as well. There's nothing completely dynamic in the styles at least for the time being or in the styles we are using. I don't think there should be even. For example it might be tempting to highlight followed users using dynamic CSS definitions.

    We are currently using EdgeCast as our CDN provider, and have been quite happy with them.
  6. Marcus

    Marcus Well-Known Member

    Great suggestion!

Share This Page