While the Pattern Lab website is great for design, iteration, alignment, and discussion - you may find yourself wanting to export whole pattern markup snippets into a different environment.
In Pattern Lab Node,
patternlab-config.json has two properties that work together to export completed patterns for use elsewhere. To export, provide an array of patternPartials and an output directory. Pattern Lab Node doesn’t ship with any patternPartials specified for export. The default directory,
'./pattern_exports/', is created inside the install directory. Here is an example with three patternPartials set.
"patternExportPatternPartials": ["molecules-primary-nav", "organisms-header", "organisms-footer"], "patternExportDirectory": "./pattern_exports/"
Couple this technique with exported CSS via tools like grunt-contrib-copy to really make patterns portable.
The PHP version of Pattern Lab is being deprecated in favor of a new unified Pattern Lab core. The PHP docs for this topic can be viewed here.