Skin Application

Version 12.1 by Guillaume Delhumeau on 2015/03/11 13:05

application_view_tileCreate, edit and manage skins in XWiki.
TypeXAR
CategoryApplication
Developed by

XWiki Development Team

Rating
3 Votes
LicenseGNU Lesser General Public License 2.1

Description

Currently, this application only offers the ability to edit an existing skin.

How to use it

  1. Go to the Administration, in the "Presentation" section:

      skin-admin.png

  2. Enter the name of the skin to edit (by default: XWiki.DefaultSkin).
  3. Click on "Customize".
  4. You will get the skin edition page:

      skin-edit1.png

  5. Here you can set the name of the skin, the parent of the skin (base skin) and you can change the logo. (The logo could be overrided by the Flamingo Theme Application).

Templates customization

Principle

A skin is made of templates written in Velocity (*.vm files), JavaScript (*.js files), CSS and LESS. Each XWiki action is bound to a template, organized like this:

ActionTemplate
Viewview.vm
Editedit.vm
Main CSS filestyle.css
Main LESS fileless/style.less.vm

Inside a template, you can include an other template, so that you can split your skin in different files. The syntax is:

#template('myTemplate.vm')

In XWiki, there is two types of skins:

  • the file system skins, which are made of template files directly stored in the webapp folder
  • the wiki skins, which are made of templates stored in the wiki.

The main skins (Flamingo, Colibri) are stored in the file system, so they can be used even when the database is empty. It is a logical choice for default skins.

The user skins are usually stored in the wiki (so in the database). They are based on existing skins but they just override some templates. They are also easier to install, since you just need to import a XAR or to install the skin with the Extension Manager.

How to override a template

There is 2 ways to override a template (+ a deprecated one):

  1. By adding an overrided template object
  2. By adding an attachment to the skin

Adding an overrided template object

  1. Go to the "Overrided templates" section:
  2. Enter the name of the template that you want to override (eg: view.vm, footer.vm, style.css, etc...). If the template is stored inside a directory, you can use the "/" character as separator (eg: less/style.less.vm, less/headers.less).
  3. Click the "add" button:

      skin-edit2.png

  4. Here you can write the content of the template. We usually take the content of the existing template from the parent skin (by browsing the http://localhost:8080/xwiki/skins/flamingo/footer.vm URL) and we add some customization in it:

      skin-edit3.png

  5. Save the skin

It's done, you have introduce an overrided template.

Adding an attachment

For resources files (images, fonts, etc) or for big templates, you can add the template as an attachment of the skin.

More informations about this.

The deprecated way

For retro-compatibility reason, we have introduced a "deprecated properties" section. In there, you can override some templates. See the documentation of this mechanism.

You should use this mechanism only for old skins that do not use the new mechanism. It has some limitations: it does not allow you to override a template located on a subdirectory, so you would not be able to override a LESS file.

Get Connected