How to bundle files correctly with community plugin

Hi,

I recently released a world building community plugin: GitHub - OnlyWorlds/obsidian-plugin

But there is an issue that I’m not sure how to best approach, as follows:

This plugin depends on sets of files to create notes from.
The plugin is configured so that on certain commands (ie. Create World), these files are copied from the plugin folder to the user’s vault.

This worked fine during plugin development.
But the plugin, when installed through the proper community plugins route, ONLY has the main.js and manifest.json file in its folder, not the to-be-copied files.

The files include:

  • a Templates folder with 18 template notes
  • a Handlebars folder with 18 handlebars files
  • a settings file
  • a README file

My first question is: is it possible to get those folders in the plugin folder when installed as community plugin?
(as in: you would see a Templates and Handlebars folder next to the main.js and manifest.json file in the plugin folder after download).
They are included in the zip file in the release assets, but I’m not sure how/whether to to add them separately there.

If copy-from-plugin-folder is not a possible or desirable approach, would you advise any specific other approach? I could try and integrate the text of the files more directly, or make API calls for them, for example.

Hope the issue is clear, I’m happy to provide more context. Thanks for any advice!

Why not download the file from a github at first onload?
Or integrate their content in TS file as string and create file using the API.

I ended up doing a combination of hardcoded strings and fetching files from GitHub. Easier than I expected, thanks!

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.