Hello,
My question is, if it's possible in jsregistry.xml to make an condition
that the javascript is only loaded if a specific theme/layer is
currently active. Google has not been able to give a solution.
And trial and just a bunch of errors haven't gotten me much further.
In one of the theme products we managed to only to make javascripts
availalbe for that layer using a zcml file:
<browser:resourceDirectory
name="beautiful.theme.javascripts"
directory="javascripts"
layer=".interfaces.IThemeSpecific"
/>
But .. since the jsregistry isn't conditional, it attempts to load it
anyway. Resulting in a -very- long load for pages due to plone's
inabilility to find the js or it's resource anywhere (unless we're on
that specific theme). We have a theme/skin switcher which works on basis
of url. So we will have situation the resource just isn't available due
to it being layer specific and us being on the 'wrong' layer.
What I want to do in jsregistry.xml is something like this:
<javascript
id="++resource++beautiful.theme.javascripts/main.js"
cacheable="False" compression="safe" cookable="False"
enabled="True" expression="python:
beautiful.theme.browser.interfaces.IThemeSpecific.providedBy(context)"
inline="False"/>
Or is there an easier and simpeler solution to this problem?
Could make browser view which does a provided by check (of some sort) I
guess, with a good bunch of caching in front. But my feeling is, there
should be an easier solution.
Regards,
Peter
_______________________________________________
Product-Developers mailing list
[email protected]
https://lists.plone.org/mailman/listinfo/product-developers