Importing resources to a webapp

Solved!
vishet
Level 3
Importing resources to a webapp

Hi,

My objective is to create a Simple HTML/JS webapp that has multiple HTML/CSS/JS files. I tried creating a resource folder under the plugin as follows '/plugins/<pluginid>/resource/<htmlfile>' and DSS was not able to reference that resource. 

On the other hand, when I place the resources under /local/static and reference them, it works just fine. Anything that I am doing wrong?

0 Kudos
2 Solutions
StanG
Dataiker

Hi,
The resource folder is located at 'plugins/dev/plugin-id/resource' or 'plugins/installed/plugin-id/resource' depending on whether it is a dev or an installed plugin (in your case it's a dev plugin), but to reference it you should use 'plugins/plugin-id/resource'.
Maybe it was the issue. Let me know

View solution in original post

0 Kudos
StanG
Dataiker

What if you try as reference path: "../../resource/PATH_TO_HTML" ?

View solution in original post

0 Kudos
5 Replies
StanG
Dataiker

Hi,
The resource folder is located at 'plugins/dev/plugin-id/resource' or 'plugins/installed/plugin-id/resource' depending on whether it is a dev or an installed plugin (in your case it's a dev plugin), but to reference it you should use 'plugins/plugin-id/resource'.
Maybe it was the issue. Let me know

0 Kudos
vishet
Level 3
Author

Thank you for the response.

I tried both. the /dev/ and the /installed/ as part of the locator /plugins/dev/<pluginid>/resource/<filename>

None of that worked. I am not sure if it is a problem with my dss instance or if there is s config issue.

0 Kudos
StanG
Dataiker

What if you try as reference path: "../../resource/PATH_TO_HTML" ?

0 Kudos
vishet
Level 3
Author

Still nothing. 

I tried accessing the body.html via http://localhost:11200/plugins/<pluginid>/<webappid>/body.html and it showed page not found. If I am not wrong, this should definitely return body.html, but it doesn't 

0 Kudos
adamnieto

Hi @vishet , 

So when I want to reference pages from the 'resource' folder inside of 

/plugins/development/<plugin-id>/editor

I add a script tag in my HTML file for my web app that follows this format: 

<script src="/plugins/ADD_YOUR_PLUGIN_ID_HERE/resource/js/angular.min.js" type="text/javascript"></script>

The above example is how I would load a angular.min.js file.

So following your example, I believe it would be something like this:

http://localhost:11200/plugins/<pluginid>/resource/body.html 

Hope this helps! ๐Ÿ™‚

0 Kudos