Symlink and Public folder issues SS4.1

Hi Phillbex,

you don’t need to use /public/ in 4.1, just delete the folder and re-run composer vendor-expose to run your site with classic webroot. TBH I don’t use it yet cause you need to update all custom modules to expose their assets. In the long run it’s surely a big improvement.

You can also tell composer vendor-expose to copy over the files automatically if you don’t want symlinks. E.g. on Windows this happens automatically, but you can set the preferred method in an ENV var, see vendor plugin docs. Somewhere I also found you can place a file /resources/.method with your preferred expose method in 4.0, but I cannot find docs for it right now.

We also wrote a blogpost about exposing theme assets to resources and include them in your theme.

In the long run I suggest you look for a decent hosting with ssh access for composer; it’s a pretty common requirement nowadays. With a script like deployer it’s easy to deploy a project via ssh. I personally use it for most of my customers. The biggest plus with using a deployment script is that it runs all tasks you need automatically, e.g. checkout from your git repo, install composer no-dev (important if you have dev requirements that don’t belong on the live server like phpunit or ideannotator), copy over to sever, do other tasks like dev/build, send notice that everythign went well etc. How often did I forget to run dev/build or flush after updating a site manually cause uploading took too long…?

Or you look in another deployment tool like e.g. buddy.works where you can define deployment pipelines with many different steps you need for each project. Depending on your budget you can get managed hosting. E.g. Derk from twistedbytes really knows what he’s doing and can help you and your customers to have stable and monitored hosting. I recently worked with him and it was a great experience. End of advertising section :wink:

The biggest problem is to change your current habbits. But that was also when you started composer or git, wasn’t it?

Edit: related topic: Handling composer vendor-expose without composer/ssh - #2 by DorsetDigital

2 Likes