Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to include css to my xhtml macro

UdayK
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 19, 2013

HI

I'm Creating a xhtml macro in confluence 4.3.2.

I would like to include a css for this macro.

So i added a webresource module in atlassian-plugin.xml file and added '#requireResource('full qualified module key')'

Unfortunately i'm unable to get the css work in the .vm file. The vm file rendered with out any css.

I also tried adding the web resource in the execute method too, like below.

webResourceManager.requireResourcesForContext("com.ca.usertabs.UserTabs:usertabs");

In above 'com.ca.usertabs' is Group Id, 'UserTabs' is artifactId and 'usertabs' is the web resource key.

What i'm doing wrong?Please help us to add the css to my macro.

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Tim
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 19, 2013

I would recommend defining your own context for your macro resources:

<web-resource key="usertabs-resources" name="usertabs-resources">
        <resource type="download" name="usertabs.css" location="styles/usertabs.css"/>
        <context>com.ca.usertabs.usertabs</context>
    </web-resource>

and include this line in your velocity template:

#requireResourcesForContext("com.ca.usertabs.usertabs")

UdayK
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 23, 2013

Seems it is pretty much working. Will try the above code and update.

Thanks for your support.

TAGS
AUG Leaders

Atlassian Community Events