Strict plugin folder name?

Hello,

I tried to name a folder plugin by prefixing it with an underscore (_plugin-name) but the plugin look like it’s not loaded.
Is there a naming convention for the plugin folder?

My use case is that I use Composer to install plugins so in .gitignore I ignore the entire site/plugins/ directory but not the custom plugins, who will start by an underscore.

# Ignore plugins
site/plugins/*

# Don't ignore custom plugins
!site/plugins/_*

Thanks!

Yes, folders starting with a dot or an underscore are not loaded:

 protected function pluginsLoader(): array
    {
        $root   = $this->root('plugins');
        $loaded = [];

        foreach (Dir::read($root) as $dirname) {
            if (in_array(substr($dirname, 0, 1), ['.', '_']) === true) {
                continue;
            }

            $dir   = $root . '/' . $dirname;
            $entry = $dir . '/index.php';

            if (is_dir($dir) !== true || is_file($entry) !== true) {
                continue;
            }

            include_once $entry;

            $loaded[] = $dir;
        }

        return $loaded;
    }

Thanks for pointing this out!
I wonder why?

I don’t know, maybe as a way to easily disable plugins without having to remove them from the folder.

I personally do it by adding a leading random string :sweat_smile:. Maybe I have to name my custom plugins by adding a custom- prefix, and pray that never any Kirby plugins will start its name by custom-

Maybe rather than using a general custom- prefix, use your agency name or initials?

Yeah that’s what I though at first but it require to think about changing the rule on the .gitignore in a case of a Kirby starter.

I think the “underscore means ignored” rule applies in Kirby to content pages as well.

For a naming policy: I’ve seen modules/custom/* used in Drupal projects and plugins/custom/* used in some WordPress projects, so I would go with that.

Yes you’re right!
So my only best option here is to stay with the custom/* folder name :+1: