Referencing local resources in plugin does not work (resURL)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Referencing local resources in plugin does not work (resURL)

r.baeris...@gmail.com
Hello all

I'm trying to get out a new release of the https://github.com/jenkinsci/docker-swarm-plugin

One change I am trying is to embedd all css/js files to it can be used in an offline jenkins instance.

For this, I added the files into the webapp folder and then referenced them like:

            <link rel="stylesheet" href="${resURL}/plugin/docker-swarm/css/clr-ui.min.css" />
            <link rel="stylesheet" href="${resURL}/plugin/docker-swarm/css/clr-icons.min.css" />
            <script src="${resURL}/plugin/docker-swarm/js/custom-elements.min.js"></script>
            <script src="${resURL}/plugin/docker-swarm/js/clr-icons.min.js"></script>
            <script src="${resURL}/plugin/docker-swarm/js/Chart.min.js"></script>
            <script src="${resURL}/plugin/docker-swarm/js/chartjs-plugin-datalabels.js"></script>

The problem is that if a jenkins instance is in a subfolder (JENKINS_OPTS / prefix=/jenkins) it does not find the resources as they now just point to /plugin/docker-swarm/... So it seems that either resUrl is not resolved or it is just empty.

Can anyone please help me here?

Best Regards
Roman

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/567065b5-ff53-4d83-b2b1-21830eecf78bn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Referencing local resources in plugin does not work (resURL)

Jesse Glick-4
On Wed, Sep 2, 2020 at 9:54 AM [hidden email]
<[hidden email]> wrote:
> it seems that either resUrl is not resolved or it is just empty.

No promises, but if you want a helpful response your chances are much
better if you link to an open pull request demonstrating the attempted
change.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr1Jvx6abnqkABOjgs5C2Fuzdu2ptTwvx%3DJT8tRpWRSNZg%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Referencing local resources in plugin does not work (resURL)

Gavin Mogan
It's unlikely that resurl would break without anyone else noticing. It's used all over.

What kind of page are you making (what filename and class).

I know if your not inside of a layout tag it won't be defined. But you shouldn't need to call layout unless your making a completely new page

On Wed., Sep. 2, 2020, 7:34 a.m. Jesse Glick, <[hidden email]> wrote:
On Wed, Sep 2, 2020 at 9:54 AM [hidden email]
<[hidden email]> wrote:
> it seems that either resUrl is not resolved or it is just empty.

No promises, but if you want a helpful response your chances are much
better if you link to an open pull request demonstrating the attempted
change.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr1Jvx6abnqkABOjgs5C2Fuzdu2ptTwvx%3DJT8tRpWRSNZg%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAG%3D_Duu3Q6NUKwYXB9UquH3rc3BQdPzKkibHkfQirUt5eR9UQg%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Referencing local resources in plugin does not work (resURL)

r.baeris...@gmail.com
I found out that in the jelly template, there is a new html/head/body tag and the  <l:layout>  was just inside the body. I moved everything inside  <l:layout> and now it correctly resolves the resURL. I will create a separate issue I have with the additional html/head/body which I need in my case.

On Wednesday, September 2, 2020 at 6:17:13 PM UTC+2 [hidden email] wrote:
It's unlikely that resurl would break without anyone else noticing. It's used all over.

What kind of page are you making (what filename and class).

I know if your not inside of a layout tag it won't be defined. But you shouldn't need to call layout unless your making a completely new page

On Wed., Sep. 2, 2020, 7:34 a.m. Jesse Glick, <[hidden email]> wrote:
On Wed, Sep 2, 2020 at 9:54 AM [hidden email]
<[hidden email]> wrote:
> it seems that either resUrl is not resolved or it is just empty.

No promises, but if you want a helpful response your chances are much
better if you link to an open pull request demonstrating the attempted
change.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr1Jvx6abnqkABOjgs5C2Fuzdu2ptTwvx%3DJT8tRpWRSNZg%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/a1a5df10-979c-4b36-adc4-744dc92639d8n%40googlegroups.com.