Skin Extension Object Fields

Last modified by Eleni Cojocariu on 2026/09/30 18:26

Reference

The fields of the two skin extension classes, XWiki.JavaScriptExtension and XWiki.StyleSheetExtension, and what each one decides once the object is saved. Create a Skin Extension is the procedure that fills them in, and Skin Extensions explains the mechanism they configure.

The fields

Both classes carry the first five fields. contentType is on the style sheet class only.

FieldLabel in the object editorTypeWhat it holds
nameNametextFree text. Purely descriptive: the plugin never reads it, and an extension is identified by the page that holds it.
codeCodeplain text areaThe CSS or the JavaScript that is served.
useUse this extensionlistWhen the extension loads. Three values, no default.
parseParse contentyes or noWhether the code is evaluated as Velocity first.
cacheCaching policylistThe cache headers of the generated file. Four values, default long.
contentTypeContent TypelistCSS or LESS. Style sheets only.

Use this extension

ValueLabel in the editorWhen the extension loadsRight the page author needs
currentPageOn this page or on demandOn the page holding the object, and whenever it is pulledSCRIPT on that page
onDemandOn demand onlyOnly when it is pulledSCRIPT on that page
alwaysOn this wikiOn every page of the wikiADMIN on the wiki

Pulling is done with the script calls on Skin Extension Script API. The right in the last column is checked on the author of the page holding the object, not on the reader and not on whoever pulls it; the reader needs VIEW on that page as well, or the extension is not served and no link to it is even generated. Both rights are described under Right Types.

Parse content

The evaluation happens before minification, so an extension can compute its content instead of storing it. Generate Skin Extension Content with Velocity covers what that allows and what it costs.

Caching policy

caching-policy.png

ValueLabel in the editorCache headers on the generated file
longLongPublic, and kept for 30 days. This is the default.
shortShortPublic, and kept for one day.
defaultDefaultPublic, with no expiry of its own.
forbidNo cachingCache-Control: no-cache, no-store, must-revalidate.

A long policy does not delay a change to the code. The generated URL carries the page version as a docVersion parameter, so saving the object changes the URL and the browser fetches the new file whatever it had cached.

Warning

What caching does freeze is a computed result. With parse set to yes, the first Velocity output the browser receives is the one it keeps until the policy expires, so an extension whose content depends on who is reading must not be cached.

Content Type

Only on XWiki.StyleSheetExtension. CSS serves the code as it stands, and LESS compiles it first, against the variables of the current skin. Write a Style Sheet Extension in LESS covers the second.

Several objects on one page

Several objects of the same class on one page are served as a single file. parse and contentType are read per object, so one object can be parsed and the next one not, and a CSS object can sit beside a LESS one. The caching policy is not read per object: it is shared by the whole page, and the strictest value present wins for all of them, long being the weakest and forbid the strongest. An object that leaves the field empty counts as long.

JavaScript strict mode

skinx.jsStrictModeEnabled in xwiki.properties decides whether JavaScript extensions are treated as strict mode code. It is false by default. Set to true, the code is parsed expecting strict mode and the minified JavaScript carries the strict mode directive; when that parsing fails, XWiki serves the unminified source instead and logs the errors. It improves performance and security, but it can break extensions that were not written for it.

FAQ

An extension set to load on this wiki does nothing. Why?

The author of the page holding the object needs ADMIN on the wiki, and the check runs when the page is saved: an object saved by an author without that right is left out of the set of always used extensions, and nothing in the interface says so. Only the log records it. Saving the page again, as an author who has the right, puts it back.

Related

Get Connected