This is a DDEV-based Drupal development environment which automates the following tasks:
- Install theme-required version of node
- Composer install to download Drupal core, modules, drush, and other dependencies
- Import custom database for Drupal
- Clear caches
- Launches a fully built Drupal site
- Install Docker & DDEV-Local
git clone git@github.com:mariohernandez/drupaltraining.git
Ensure Docker is running before proceeding.
cd drupaltraining
ddev start
This will take a few minutes. If you encounter any errors, run ddev restart
Done! 🙌
http://drupaltraining.ddev.site/user/
Username: admin
, password: admin
The custom Drupal theme, training_theme
, can be found in web/themes/custom/
. Commands to interact with the theme can be ran from anywhere whithin this project.
ddev nvm install && ddev nvm use
- This will install version of node declared in
.nvmrc
and will set the theme to use it.
ddev npm install
- This command will install all of the theme's node dependencies (Gulp, Pattern Lab, Autoprefixer, Browsersync, eslint, sass-lint, and others).
- These last two commands above may only be need to run once.
ddev npm run build
- This command builds the entire codebase for the theme.
- If you encountered npm errors, run
ddev npm rebuild node-sass
, and try the build command again.
To ensure Drupal is able to access all the theme's assets after building the theme above, clear Drupal's caches.
ddev drush cr
ddev npm run watch
- In addition to compiling the theme, this tasks stays running to watch for new code changes within the theme, then automatically compiles them.
- While the watch task is running, you can access Pattern Lab by going to
https://drupaltraining.ddev.site:3000
, or port 3001 if usinghttp
.
Official DDEV-Local docs.
ddev poweroff
Stop DDev if not longer using.
ddev start
Start DDev to work on project.
ddev delete --omit-snapshot --yes
If project is no longer needed, this will wipe everything out including database. Use ddev start
to rebuild project from scratch.
ddev drush <command>
example: ddev drush cr
, ddev drush updb -y
, etc.