Importing resources to a webapp
![vishet](https://us.v-cdn.net/6038231/uploads/Dataiku/nAvatar23.png)
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?
Best Answers
-
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 -
What if you try as reference path: "../../resource/PATH_TO_HTML" ?
Answers
-
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.
-
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
-
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!