If I am managing my drupal 8 site using the Composer workflow, how should I go about incorporating/managing custom themes and modules?

Let's say I have a custom theme that I manage using gitlab.

Do I bring in the custom theme using git clone after running composer install for the site?

Or should I add the git repo for the custom theme into composer.json so that the theme is installed during composer install?

What happens if the git repo is private?

  • 1
    This is probably too broad, and it depends on your deployment work flow. Either works. If you have a CI or similar tool that builds the site and then you deploy the build artifacts, then managing with composer makes it easier. On the other hand, if you deploy via Git, then it may make sense to build into webroot.
    – mradcliffe
    May 8, 2019 at 21:54
  • 2
    I wrote up a blog post that can probably answer some of your questions: morpht.com/blog/…. See the section on managing custom code with Drupal.
    – Jaypan
    May 8, 2019 at 22:20
  • My workflow: Project-specific, one-off modules and themes directly into the project's git repo. Multi-project / shared base themes or modules into separate repos and fetch with composer. For private repos I'm using SSH keys so I can do scripted deployments.
    – Hudri
    May 9, 2019 at 10:17
  • Thank you, that helps a lot. I added this to your question. I have used a similar work flow to manage and do composer require/update operations into a project-based repo, and then deployed via git, and run composer install afterward. But something similar could be done
    – mradcliffe
    May 9, 2019 at 11:29
  • 1
    @mradcliffe That was info from a different user (not the OP)
    – Clive
    May 9, 2019 at 11:36


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.