A beginner question about Composer and the project folder structure

Hello,

I am quite a beginner, so sorry if the question is quite basic. I developed a first release of a wp theme locally with ROOTS and now I would like to integrate my workflow with Composer .

I am trying to have as result one git repo with the minimal amount of files:

  • my teme files already set in the proper directory: wp/wp-content/themes/
  • the composer installer in charge of installing wordpress and the required plugins

I am having problems figuring out how to properly set the project structure. I have been able to set and execute composer, it downloads wordpress and the plugins needed but at the same time it overwrites the theme directory, installing the default wp themes and deleting my custom theme.

So my question is basically how to get around this?
Is there a way to avoid composer overwriting the custom theme? Or how I could organize my project?

I have some ideas, like for example using two repos, one containing only the custom theme and another that I could use just to call composer and put all together (still not tried this and I don’t know it would be a good solution).

What is the best practice?

Thanks in advance,

Fabio

If you can, do a fresh install with bedrock and look at the structure. You should only need one repo and everything that is installed by composer should be in your gitignore file. I guess the reason composer is removing your theme is that your are not installing WP in to its own folder (this is just a guess). Look at WP Skeleton if you don´t know how to give WP its own folder, but I would suggest starting by using the structure in Bedrock.

Thank you very much for you advice. I didn’t gave the proper attention to the Wp Skeleton and Bedrock repo. Thanks very much for the hint!

Glad to help out :smile: