Closed phabegger closed 10 years ago
@phabegger This is effective cached, see https://github.com/OneGov/plonetheme.onegov/blob/master/plonetheme/onegov/viewlets/customstyles.py#L17 It's not possible to put this into the css-registry because the styles are generated for each subsite, but the registry is over the whole page.
We need to find another solution for this - each page load is now an extra 80 KB of data as far as I can see... IMHO this is not an option! @jone @buchi any ideas?
@ninfaj @phabegger We already discussed this: I guess the best solution is to register a viewlet in the htmlhead manager (insert after all other viewlets), which renders a link tag for the onegov css. Something like...
<link rel="stylesheet" type="text/css" media="screen" href="http://plonesite.com/onegov.css">
The viewlet has to respect INavigationRoot Interface. For example on a Subsite (and all sites below), the link should look like this.
<link rel="stylesheet" type="text/css" media="screen" href="http://plonesite.com/path/to/subsite/onegov.css">
onegov.css
is a BrowserView, which gets the actual css, based on where you are.
The css resource needs to be cacheable by the browser (caching in Plone is not enough). It must not be included inline but should be included as an external resource. Further the url of the css resource must contain a cache key which changes every time the custom css is changed. Expiration should be at least +1 week.
Source code of http://onegov.ch contains very long inline css (in html) - should be put in a separate file (if needed at all) in order to allow for effective caching!