How can I have case-sensitive theme directory names when installed with Composer?

I’m using SatisPress (https://github.com/cedaro/satispress) to expose some premium plugins and themes as composer packages, because I would like to use the roots/bedrock boilerplate.

Now I have the following issue:
The Divi theme (https://www.elegantthemes.com/gallery/divi/) uses a capital letter for the themes directory (“Divi” not “divi”). Now when I use

composer require satispress/divi

it downloads the package and installs it to the correct directory and the theme is showing and is usable.

However the themes directory is now all lower case (“divi” not “Divi”) which breaks child themes based on Divi.

What I found:

  • Behaviour occurs on bedrock as well as in an empty directory
  • The packages zip files created by SatisPress have the correct case in the zips name and in the contained files as well

While it should be possible to just change the child themes template entry to lower case, this could be problematic when (for whatever reason) the main theme would be installed the “normal” way, now containing upper case again and break the site.

So:
Is there a way to change the behaviour of either SatisPress or composer to allow for upper case letters in directory names?

1 Answer
1

That would be a task for oomphinc/composer-installers-extender. With that you can specify the directory where a package should be installed to. And it’s case-sensitive. Composer otherwise is case-insensitive.

{
    "extra": {
        "installer-paths": {
            "my/themes/Divi/": ["satispress/divi"],
        }
    }
}

Leave a Comment