A sample Drupal 8 site with a Pattern Lab Twig powered theme.
All commands starting with bash
are run from root of repo; all that start with drupal
are ran from web/
composer
installed- node js installed - supported node versions: 0.12.x, 4.x, 5.x, and 6.x using npm 2.x or 3.x.
bash scripts/site-setup.sh
When it asks if you want to merge or replace stuff, select merge.
In two Terminal tabs, run:
- Run
composer run server --timeout=0
- Run
npm start
inweb/themes/dashing/
- Username:
admin
- Password:
admin
bash scripts/site-reinstall.sh
../vendor/bin/drupal cr all
All commands are run from root of theme in web/themes/dashing/
. An npm install
was ran in site-setup.sh
script, run npm install
if you don't see node_modules/
or have errors.
To compile theme (CSS & Pattern Lab):
npm run compile
To execute watches on Scss and Pattern Lab along with a server for Pattern Lab, run:
npm start
drush dl patternlab
That will download a Drupal Theme ready to go: GitHub repo ~ Drupal.org project page.
Here's a collection of the tools used to build this site; go make something cool with them!
- Pattern Lab 2.0 - Drupal Edition - this collection of tools super charges what could be done with Pattern Lab 1.0 and is made up of these pieces:
- Twig Engine for Pattern Lab - instead of the traditional Mustache engine in Pattern Lab 1.0, this uses Twig, which is much more powerfule, and is template language in Drupal 8!
- Drupal Twig Components plugin - this adds extra functionality to Pattern Lab's Twig Engine, and let's use the essential
link
&trans
Twig Functions; among many more! - Data Transform plugin - this super charges the JSON/YAML Pattern Sidecar data files to effectively let you pre-process data before rendering Twig templates. Incredibly powerful & flexible. Made by the awesome Aleksi Peebles.
The above tools give us a Twig powered, Drupal-aware Pattern Lab and can be spun up with:
composer create-project pattern-lab/edition-drupal-standard
We've made a Drupal theme called Pattern Lab Starter that integrates the above Pattern Lab Drupal Edition along with Gulp tasks for common theme needs.
After making changes, run ../vendor/bin/drupal config:export -y
and commit the files. If you just pulled or are deploying, run ../vendor/bin/drupal config:import -y
to pull configuration changes present in the yaml files in web/sites/default/config/sync/
into the database. Very similar to Features in Drupal 7.
To install a new Drupal module, run this:
composer require drupal/MODULE_NAME:8.*
After enabling, do a ../vendor/bin/drupal config:export -y
.
Built with love at Phase2 by Evan Lovely, Anne Sturdivant, and Chris Bloom. Most of the work to make this possible happened over at the Pattern Lab GitHub org with collaboration from Dave Olsen & Aleksi Peebles. Special thanks to Kellye Rogers and Frank Febbraro for supporting this internal project and wanting to share it with the community!