An open API service indexing awesome lists of open source software.

https://github.com/mariohernandez/drupaltraining

Drupal training codebase built with DDEV.
https://github.com/mariohernandez/drupaltraining

ddev drupal

Last synced: 11 days ago
JSON representation

Drupal training codebase built with DDEV.

Awesome Lists containing this project

README

          

# Drupal training
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

## Let's start

### 1. Software requirements
* Install [Docker & DDEV-Local](https://ddev.readthedocs.io/en/stable/#installation)

### 2. Clone the repo:
```
git clone git@github.com:mariohernandez/drupaltraining.git
```

### 3. Build the project:
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! 🙌

---
### Login to Drupal
http://drupaltraining.ddev.site/user/

Username: `admin`, password: `admin`

## Working with the theme
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.

### Install theme dependencies
```bash
ddev nvm install && ddev nvm use
```
* This will install version of node declared in `.nvmrc` and will set the theme to use it.

```bash
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.

### Build/Compile the theme
```bash
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.

### Clear Drupal caches
To ensure Drupal is able to access all the theme's assets after building the
theme above, clear Drupal's caches.
```bash
ddev drush cr
```

### Run the watch task to access Pattern Lab
```bash
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 using `http`.

## Interacting with DDev
Official DDEV-Local docs.

```bash
ddev poweroff
```
_Stop DDev if not longer using_.

```bash
ddev start
```
_Start DDev to work on project_.

```bash
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_.

### Running Drush commands
```bash
ddev drush
```
example: `ddev drush cr`, `ddev drush updb -y`, etc.