CSS and Javascript not loading into Jira plugin Edited

I'm trying to load the css and javascript files into my plugin, but despite having what I think is the correct code in the atlassian-plugin.xml file, nothing appears to be loaded. I've seen other people have the same problem but their solutions don't work for me.

Here is what I have for the code:

<web-resource key="example-report-resources" name="example-report Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<dependency>com.atlassian.auiplugin:aui-experimental-table-sortable</dependency>
<resource type="download" name="example-report.css" location="/css/example-report.css"/>
<resource type="download" name="example-report.js" location="/js/example-report.js"/>
<resource type="download" name="images/" location="/images"/>
<context>example-report</context>
</web-resource>

 

Does anybody know why the files aren't being imported?

 

EDIT: I forgot to mention that I had this line of code in my view.vm file already. sorting works so I'm sure importing of at least that dependency was successful, but I'm not sure why my js and css files are not taking affect.

$webResourceManager.requireResourcesForContext("example-report")

1 answer

0 vote

You need to add

$webResourceManager.requireResource("yourpluginkey:example-report-resources") to your vm template

Whoops, forgot to mention I had this added to the vm template. The tables are sortable so I'm assuming the web-resources have been loaded successfully, but I don't see the js or css taking affect on my plugin

$webResourceManager.requireResourcesForContext("example-report")
Alexey Matveev Community Champion Jan 10, 2018

Put the first line into your js

alert("hello");

and see if the message appear. It it appears then there are errors in your js, if the message does not appear then js is not loaded

The message does not appear, so the js is not loading for some reason

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 ...

3,319 views 14 20
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