Override a Skin Resource with an Attachment

Last modified by Eleni Cojocariu on 2026/09/23 14:52

Steps

Replace a resource of a wiki skin with a file attached to the skin page, with administration rights on the wiki.

  1. Open the skin page of the wiki, as described in Customize a Skin.
  2. Name the replacement file after the resource it replaces, writing each / of the resource path as a .:
    icons/xwiki/noavatar.png    the path of the resource to replace
    icons.xwiki.noavatar.png    the name to give the attachment
  3. Open the "Attachments" tab at the bottom of the skin page, choose the file, and attach it:

    skin-document-attach-file.png

  4. Open a page that shows the resource, and check that the one displayed is the file you attached:

    skin-attachment-override-result.png

FAQ

When should I use an attachment rather than an overriding template?

Whenever the replacement cannot be typed into the "Content" field of an override, which is the case of every binary file and of any file too large to work with comfortably in that field, and whenever the resource is fetched with $xwiki.getSkinFile().

Why can an overriding template not replace print.css?

The address the templates build for it leads to the override's own field instead of the resource, and nothing is served (XWIKI-18297). An attachment is served at a working address.

The style sheet I attached has no effect. Why?

For a .css or a .js resource XWiki looks for the minified name first, so print.css is searched as print.min.css. Attach the file under the minified name, or set debug.minify=false in xwiki.properties.

How do I stop using the attached resource?

Delete the attachment from the skin page. The resource XWiki served before it is served again, on every page displayed with that skin.

Related

Get Connected