This is a hands-on training workshop by Mediacurrent.
Before proceeding, install Docker and DDev.
- Docker: Install Docker on macOS or Windows 10
- DDev: Install DDev on macOS or Windows 10
After installing Docker and DDev, be sure Docker is up and running and follow the steps below.
-
Using the command line tool of your choice, navigate to the directory where you would like to setup your project. This can be any directory in your computer, such as
Sites
,My Documents
, etc. -
First clone the repo:
git clone [email protected]:mariohernandez/drupal_training_ddev.git
- Change into the newly created directory by the repo command above (
drupal_training_ddev
). If you changed this directory name, use the name you specified.
cd drupal_trianing_ddev
- Then run:
ddev start
This will install Drupal and import the database which includes all the cofiguration needed for the training. It will also enable the required modules. This process could take a couple of minutes.
The theme name for this project is training_theme
. All documentation and exercises make reference of this theme name. DDev already provides all the tools needed for compiling JSON, Twig, Sass, and JavaScript code. This means you don't need install any of the Front-end tools in your local machine.
The Drupal 8 theme is a Node-based theme which uses Pattern Lab, Gulp, Node Sass, and other node dependencies.
- Install the theme dependencies:
ddev nvm use && ddev npm install
The first command sets your project to use the Node version specified in .nvmrc
, and the second command installs al of node dependencies found in package.json
. You will only need to run these commands one time for the most part. This could take a couple of minutes.
ddev npm run build
This command will compile your entire theme codebase.
ddev npm run watch
This command will compile your entire theme codebase and will stay running in the background watching for new changes. Everytime you save new changes in your theme's code, it will compile them automatically.
- In your browser open http://d8.ddev.site/user
- Username:
admin
, password:admin
If you wish to generate a one-time login token to automatically login as admin, run the following command:
ddev . drush uli
This will provide a unique URL that by clicking on or pasting in your browser will automatically log you in.
To access Pattern Lab navigate to the url below: http://d8.ddev.site/themes/custom/training_theme/patternlab/?p=all
This project includes the following:
- Latest Drupal 8
- Drupal 8 theme,
training_theme
- Pattern Lab
- Gulp
- NVM, NodeJS, and NPM
- Twig debugging enabled
- Contrib modules:
- Core modules
- Media
- Media library
- Responsive image
- Custom content types, paragraph types, and views