BLT is normally used to create new projects from scratch, but you can also add BLT to an existing project to get all of the same benefits as a normal BLT project.
Adding BLT to an existing project can be more complex than creating a new site with BLT since BLT includes a project template and expects the files in your project to match the structure and contents of this template.
BLT will attempt to generate any missing files when it is installed, but it can't account for every possible project structure and some manual reconciliation may be required. Adhering closely to the prerequisites and instructions below should ensure a good outcome.
Prerequisites:
- The Drupal root must be in a top-level
docroot
directory. - You must already use Composer to manage site dependencies. If you don't, please see Using Composer to manage Drupal site dependencies and modify your project accordingly.
- Ensure that your dependencies are all up to date via
composer update
. Assert that these updates do not break your project.
To add BLT to a pre-existing Drupal project, do the following:
-
cd
into your existing project directory. -
Set Composer's
minimum-stability
todev
andprefer-stable
totrue
:composer config minimum-stability dev composer config prefer-stable true
-
Add BLT via composer:
composer require acquia/blt:^10.0 --no-update composer update
-
Replace your
.gitignore
file with BLT's template.gitignore
, then re-add any project-specific overrides:cp vendor/acquia/blt/subtree-splits/blt-project/.gitignore .
-
(optional, but recommended) Replace your
composer.json
with BLT's templatecomposer.json
, and re-add any packages or other configuration that you wish to preserve from your existingcomposer.json
:cp vendor/acquia/blt/subtree-splits/blt-project/composer.json .
-
BLT will have placed a number of files in your project directory that were likely not present before. Be sure to review these, as well as the files listed above, and commit them to Git.
-
Run
blt doctor
to diagnose any potential remaining issues that require manual intervention. -
Continue following instructions after the
composer create-project
command in Creating a new project with BLT.