2017 © Pedro Peláez
 

silverstripe-module silverstripe-patternlab

Pattern lab.

image

dnadesign/silverstripe-patternlab

Pattern lab.

  • Thursday, January 21, 2016
  • by Leapfrognz
  • Repository
  • 9 Watchers
  • 7 Stars
  • 1,511 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 2 Versions
  • 4 % Grown

The README.md

Pattern Lab Module

Introduction

Pattern lab is a module which allows a SilveStripe developer to have a single place where they can define static HTML with which to test against. Often in project an element on a page may have multiple states or variances which need to be browser tested for, however since the CMS is database driven there isn't any gurantee that every instance possible will be covered in the existing content. Pattern lab's allow you to create static HTML for each of these variances in order to record and test for each one., (*1)

You can read more about pattern labs here: http://bradfrostweb.com/blog/post/atomic-web-design/, (*2)

Using this module

Create a pattern folder under your templates directory: templates - Patterns, (*3)

Then begin creating pattern templates in this folder such as: templates - Patterns - Pattern1 - Pattern2, (*4)

These will turn up on the index page automatically at /patterns and you will be able to click through to the pattern which will then render the pattern's template., (*5)

As these are not pages <head> tags will need to be included in each file we generally recommend the following:, (*6)

<% include Head %>
Some Content
<% include Foot %>

Use the includes above in your Page.ss to ensure there's consistency in the head markup, doctype etc., (*7)

Custom Lab Controller

Optionally extend PatternLab_Controller with a name such as MyPatternLab like so:, (*8)

class MyPatternLab extends PatternLab {

}

This lets you add an init function like your Page.php's init function to ensure they're both including the same CSS and Js., (*9)

You'll need to create a routes.yml file to override the existing route config:, (*10)

---
name: routes
After: 'pattern-lab'
---
Director:
  rules:
    'patterns//$Action/$ID/$Name': 'MyPatternLab'

The Versions

21/01 2016

dev-master

9999999-dev

Pattern lab.

  Sources   Download

BSD-3-Clause

The Requires

 

by John Milmine

testing silverstripe patterns

10/06 2014

dev-change_filename_to_match_classname

dev-change_filename_to_match_classname

Pattern lab.

  Sources   Download

BSD-3-Clause

The Requires

 

by John Milmine

testing silverstripe patterns