Web Resource Transformer plugin module


Atlassian Plugin Framework 2.5 and later.

Purpose of this Module Type

Web Resource Transformer plugin modules allow you to manipulate static web resources before they are batched and delivered to the browser. This means that you can get past the restrictions of straight JavaScript and CSS, including restrictions like no includes, no external resource support, no CSS variables, only one JS context, and so on.


To use a web resource transformer, you need the following elements in your atlassian-plugin.xml file:

  • The transformer module: A <web-resource-transformer> element, defining the transformer plugin module. This module can be in the same plugin as the web resource, or in a different plugin.
  • Transformation elements in the web resource module: A <transformation> element and its child <transformer> element inside the <web-resource> block, making a particular transformer available to the web resource in the plugin.

Below is a description of the attributes and child elements for each of the above elements.

Attributes of web-resource-transformer




The class which implements com.atlassian.plugin.webresource.transformer.WebResourceTransformer. This class is responsible for doing the resource transformation before it is served to the client. See the plugin framework guide to creating plugin module instances.


Indicate whether the plugin module should be disabled by default (value='disabled') or enabled by default (value='enabled').

Default: enabled


The localisation key for the human-readable name of the plugin module.


The unique identifier of the plugin module. You refer to this key to use the resource from other contexts in your plugin, such as from the plugin Java code or JavaScript resources.




In the example, appProps is the key for this particular module declaration, for component-import, in this case.

The value of this attribute must match the key attribute of the transformer element in the web-resource.


The human-readable name of the plugin module.


Indicates whether this plugin module is a system plugin module (value='true') or not (value='false'). Only available for non-OSGi plugins.

Default: false

*class and key attributes are required

Child Elements of web-resource-transformer

DescriptionThe description of the plugin module. The 'key' attribute can be specified to declare a localisation key for the value instead of text in the element body.

Attributes of transformation

DescriptionDefines a transformation process.

*extension attribute is required

Child Elements of transformation

DescriptionDefines a transformation process.

*transformer element is required

Attributes of transformer

DescriptionThe value of this attribute must match the key attribute of the web-resource-transformer element.
*key attribute is required
DescriptionYou can add your own attributes as required, to pass information to your implementation of the transformer.

Child Elements of transformer

DescriptionYou can add your own child elements as required, to pass information to your implementation of the transformer.


Here is an example atlassian-plugin.xml file containing a web resource and a transformer that turns a static template file into a JavaScript variable. You could use this transformer for common components that need to use client-side templates.

<atlassian-plugin name="Hello World Resource" key="example.plugin.helloworld" plugins-version="2">
  <description>A web resource module with a transformer</description>
  <vendor name="Atlassian Software Systems" url="http://www.atlassian.com"/>
<web-resource key="testTemplate">
  <transformation extension="txt">
    <transformer key="template" />
  <resource type="download" name="testTemplate.js" location="testTemplate.txt" />
  <resource type="download" name="testTemplate.css" />
<web-resource-transformer key="template" class="com.atlassian.labs.template.TemplateTransformer" />

The template testTemplate.txt file looks like this:

Hello world "bob"
and 'friends'

The JavaScript resulting from the transformation is:

var testTemplate = "Hello world \"bob\"\nand \'friends\'";


Some information to be aware of when developing or configuring a Web Resource Transformer plugin module:

  • The <web-resource-transformer> module can live in the same plugin as the <web-resource> module, or in a different module. The transformers are registered globally.
  • You can apply multiple transformers. Any subsequent transformer will process the result of the earlier transformation.
  • You can pass information to the transformer by adding arbitrary attributes and child elements to the <transformer> element in the resource.

Web Resource Plugin Module
Plugin Modules

Rate this page: