Can't link my custom CSS-file!

I can't reference my own CSS-file. It is defined in src/main/resources/css. What do I need to to include in my html-code (vm-file) and where has it to be included?

2 answers

1 accepted

Can you please give a code sample? Usually you put <link rel="stylesheet" type="text/css" href="formate.css"> into the header.

I've already defined the css-web-resource, but how do I connect it to the link tag? Or somehow else?

The page describes 3 options. I would recommend one of two:

1. use webResourceManager.requireResource

2. include the resource in the context of the page

Ok, I understand. You don't need the link tag in the header of the html-file.

You simply define your web-resource (do not forget context!!!) in atlassian.xml:

&lt;web-resource key="key-Name" name="name Resource"&gt;
        &lt;dependency&gt;com.atlassian.auiplugin:ajs&lt;/dependency&gt;
        
        &lt;resource type="download" name="my-listener-plugin.css" location="/css/my-listener-plugin.css"/&gt;
        &lt;resource type="download" name="my-listener-plugin.js" location="/js/my-listener-plugin.js"/&gt;
        &lt;resource type="download" name="images/" location="/images"/&gt;

        &lt;context&gt;your-context&lt;/context&gt;
    &lt;/web-resource&gt;

And then you reference this context, by putting following line of code into the header of the html-file:

$webResourceManager.requireResourcesForContext("your-context")

That's how it works. By referencing this context, you also have access to all other resources defined in your web-resource like js, images, ...

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,887 views 12 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot