plugin serve static files and load into custom panel #4020
-
Hello, I'm currently continuing working on my plugin. It has a complex reactive form which I don't want to do by hand in vanilla js, so I decided to try out preact in combination with htm. However to use this, I would need to load static scripts which add something to the window object. Is there any way where I can place my scripts to serve them via |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 16 replies
-
Unless @matmair has another suggestion, I think that this would be difficult in the current architecture, for a number of reasons. First and foremost is how static files are served. They must be stored under the Secondly, defining how pathing to plugin files under Perhaps there is a way to make this work, but my suggestion would be: Template Files: Include the files you want as part of your plugin template directory, and load them into the webpage External Files: Nothing stopping you loading files from an external service Upload Media Files: You can upload custom files to the Upload Static Files: You can always place your own custom files within the |
Beta Was this translation helpful? Give feedback.
Unless @matmair has another suggestion, I think that this would be difficult in the current architecture, for a number of reasons.
First and foremost is how static files are served. They must be stored under the
STATIC_ROOT
directory (on your filesystem). The plugins do not have access to this directory, and exposing external directories to the fileserver is a huge security hole.Secondly, defining how pathing to plugin files under
/static/
works, without shadowing required files, is problematic.Perhaps there is a way to make this work, but my suggestion would be:
Template Files: Include the files you want as part of your plugin template directory, and load them into the webpage
External…