Hi devs,
Following a discussion at
http://jira.xwiki.org/browse/XWIKI-12327# I’d like to propose to
add this new best practice in the App Guide, i.e.
at
http://platform.xwiki.org/xwiki/bin/view/DevGuide/BestPractices
Rule: Do not use Skin-specific resources in Extensions/Applications
Rationale: If you do, then your Extension/Application will only work for that Skin. When
the default skin in XWiki is modified, your Extension/Application will stop to work fine.
Example: This is what happened in apps like in the Forum app which was using:
getSkinFile(“noavatar.png”) where “noavatar.png” was a Colibri-skin resource only. The
Forum app was broken when we moved to Flamingo and the Forum app had to be modified to use
getSkinFile("icons/xwiki/noavatar.png”) which is better since it’s a global resource,
thus available to all Skins
(see
https://github.com/xwiki-contrib/application-forum/commit/3d3a99e5665265607…).
WDYT? Anyone disagree? I’d like to clos this topic quickly so that we can close
XWIKI-12327.
Thanks
-Vincent
PS: Additional idea (I don’t know if it’s feasible): I wonder if we could even prevent
getSkinFile() to return a skin-specific resource if the originating code is not from a
resource from this Skin or if the originating code is not located in a Children Skin (i.e.
a skin css, skin jss or skin vm). i.e. consider that skin-specific resources have a
private access level.