Theme folders are not being exposed - Expose is asking to expose a folder that is not created during installation

Silverstripe Version: 4.7.3

Summary: When installing a theme via terminal (gitbash) on WAMP (Win10), I often come across an error of missing folder during the exposing web directories step. The error is that a folder is missing and therefore cannot be exposed.

In the example below, I noticed that the composer.json file is asking to expose 5 folders, but the actual installation process only creates 4 of these folders.

"expose": [
            "css",
            "javascript",
            "images",
            "icons",
            "fonts"

As the installation did not create an ‘images’ folder, when the exposing task doesn’t find this folder, it stops the task and the folders below ‘images’ in the list (icons, fonts) are not exposed.

Question: What’s the best way to resolve this issue?

  • My immediate thought is to make a copy of the repository, change the composer.json to not expose ‘images’ and install it again. But there must be a cleaver way to resolve it?
  • I also tried to (1) manually creating the missing (images) folding, (2) deleting the public/ folder and (3) running variations of ‘Composer update’ or ‘Composer vendor-expose’, in an attempt to expose everything again, but it does expose everything again, except the themes folders.

Thanks for anyone that can help.
I just would like to know the correct, proper way in this case.

Package operations: 1 install, 0 updates, 0 removals
  - Syncing theme/silverstripe-theme (dev-master xxxxxx) into cache
  - Installing theme/silverstripe-theme (dev-master xxxxxxx): Cloning xxxxxxxx from cache
Exposing web directories for silverstripe-theme name/silverstripe-theme with method auto:
  - css
  - javascript
  - images
  - icons
  - fonts
 
[ErrorException]
  copy(C:\wamp64\www\project-name\themes\theme-name\images): failed to open stream: No such file or directory

By the sound of it, you’re at the mercy of whomever maintains the theme. If the composer file wants to expose the directories and they’re not present, then as you correctly state, you either need to create the directory or update the composer file.

Probably worth logging an issue on the theme’s repo… hopefully the maintainer will be able to make a quick fix.

Thank you for your suggestion, will raise an issue with them to let them know :slight_smile: