Synchronizing Skin Layers and CSS/Javascript Resources

by George Lee last modified Dec 30, 2008 03:05 PM

How to ensure that the proper CSS/Javascript resources are used in different skins.

Switching skins changes what skin layers in portal_skins are used, but it does not switch what CSS and javscript resources to load. This could be disastrous if you have CSS that applies only to the page templates in one skin, but not to the page templates in another skin.

The solution is simple: in the portal_css or portal_javascripts tools, just add a condition on certain resources similar to

python:portal.getCurrentSkinName() == 'My Public View'