Override a Skin Resource with an Attachment

Last modified by Eleni Cojocariu on 2026/09/16 14:53

Steps

A skin resource can also be replaced by attaching the replacement file to the skin page, rather than typing its content into an override on that page. An attachment is the method for a file an override cannot hold, an image or a font among them, and for the resources an override cannot serve at a working address. You need administration rights on the wiki, and Customize a Skin describes the other method.

  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 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