Giter VIP home page Giter VIP logo

drupal-lab's Introduction

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!

drupal-lab's People

Contributors

evanlovely avatar anniegreens avatar illepic avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.