Skip to content

A sample Drupal 8 site with a Pattern Lab Twig powered theme.

License

Notifications You must be signed in to change notification settings

phase2/drupal-lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Join the chat at https://gitter.im/pattern-lab/php Docs

Drupal Lab

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/

Setup

Prerequisites

  • 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.

Site Install

	bash scripts/site-setup.sh

When it asks if you want to merge or replace stuff, select merge.

Usage

Run Drupal & Pattern Lab Servers

In two Terminal tabs, run:

  1. Run composer run server --timeout=0
  2. Run npm start in web/themes/dashing/

Drupal Credentials

  • Username: admin
  • Password: admin

Rebuild

	bash scripts/site-reinstall.sh

Cache Rebuilds

	../vendor/bin/drupal cr all

Theme & Pattern Lab

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

How to build your own

Simple, pre-packaged Drupal Theme with Twig Pattern Lab
	drush dl patternlab

That will download a Drupal Theme ready to go: GitHub repo ~ Drupal.org project page.

Custom configured Drupal Theme with Twig Pattern Lab

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.

Configuration

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.

Install Drupal Modules

To install a new Drupal module, run this:

composer require drupal/MODULE_NAME:8.*

After enabling, do a ../vendor/bin/drupal config:export -y.

Who's behind this?

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!

About

A sample Drupal 8 site with a Pattern Lab Twig powered theme.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •