"Right place" for a directory of plugin-generated files?

I’m working on a plugin that needs to write source files, compile them by calling a separate binary, and use the compiled results. To avoid unnecessary recompilation, I want to keep the source files around between builds.

I’d like this to happen in a dedicated directory. It doesn’t need to be 100% private or protected, but I do want to make sure the source files I write don’t clobber anything else, and that existing user workflows don’t interfere with them — and giving them their own directory seems like the safest bet.

Where in the source tree should this directory go? Is there a “right place” that the community acknowledges is best for this? If not, do you have suggestions?

Welcome @leahvelleman :tada:

I’m not a plugin developer, but I guess as long as you don’t use a Jekyll directory you will be OK.

You might want to prefix that directory with _ (underscore) to prevent it from being copied to the generated website, inside the _site directory.

I’ve seen that some plugin/theme developers do it that way.

I only know of one example and this a plugin I forked.

cache/resize

It seems like a good pattern for multiple plugins to cache and their plugin name.

The cache folder is not reserved in Jekyll and will be copied into _site as it has has leading dot or underscore.

Just add this to ignore file.

cache/

See also .sass-cache and .jekyll-cache as names for directories handled by Jekyll itself but of course not for output files because of leading dot. I’m guessing Jekyll generstes files in there if they don’t exist and then copies to _site. You might not need the two step process in your plugin.