Homepage    |    GitHub    |    API    |    FAQ

Getting location of plugin folder in plugin

Hello,

I'm working on an export plugin, and I want to copy some files (js / css) from my plugin to the export folder. For this, I need the location of my plugin folder (or jpl) at runtime.

Is it possible? Does it make sense? How could I do it?

Thanks

not sure which is the path you want

const await = joplin.settings.globalValue("pluginDir");or const await = joplin.settings.globalValue("pluginDataDir");

Without more info this is difficult to answer.

There's also joplin.plugins.installationDir

I'll test the suggestions later on today.

To give some more details: my plugin creates an HTML file, and I want to use bootstrap, jquery and some custom CSS there.
So, the way I see it is that I place the files I need in some of my plugin folders, and when the user executes it, I copy those files to the location of the HTML (or a subfolder)..

Thanks

Or you can bundle all you need into one .js file using webpack.

Looks like a good suggestion. I'll look at it in the coming days.

Thanks

If you decide to go down this route make sure to test both in dev mode (running from source folder) and with .jpl because there are difference in how the script is executed in these 2 cases.