Configuration objects determine where Labcoat will look for files. They also control some features of the style guide interface.
Labcoat comes with two configuration subclasses, for use with common Pattern Lab installations.
This configuration class is for installations of the Pattern Lab Standard Edition for Twig. It expects the following file structure:
- config
- config.yml
- source
- _annotations
- _data
- _meta
- _00-head.twig
- _01-foot.twig
- _patterns
- styleguide
$config = new Labcoat\Configuration\StandardEditionConfiguration('/path/to/patternlab');
$labcoat = new Labcoat\PatternLab($config);
# If you don't need to modify the $config variable, you can use
$labcoat = Labcoat\PatternLab::loadStandardEdition('/path/to/patternlab');This class expects the following file structure:
- assets
- data
- patterns
- styleguide
- footer.twig
- header.twig
- assets
$config = new Labcoat\Configuration\LabcoatConfiguration('/path/to/patternlab');
$labcoat = new Labcoat\PatternLab($config);
# If you don't need to modify the $config variable, you can use
$labcoat = Labcoat\PatternLab::load('/path/to/patternlab');| File | Standard Edition | Labcoat |
|---|---|---|
| Patterns | source/_patterns | patterns |
| Global data | source/_data | data |
| Assets | source | assets |
| Annotations | source/_annotations/annotations.js | styleguide/annotations.js |
| Header template | source/_meta/_00-head.twig | styleguide/header.twig |
| Footer template | source/_meta/_01-foot.twig | styleguide/footer.twig |
| Styleguide assets | source/styleguide | styleguide/assets |
- Patterns
- Pattern templates and pattern-specific data files
- Global data
- Data shared by all patterns and styleguide pages
- Assets
- Static files (stylesheets, scripts, images) used by both the styleguide and the production site
- Annotations
- A Javascript file containing pattern annotations
- Header template
- Twig template for styleguide page headers
- Footer template
- Twig template for styleguide page footers
- Styleguide assets
- Static files used only by the styleguide
Configuration objects provide the following customization methods:
- addAssetDirectory($path)
- Add a path to the list of asset directories
- addGlobalData($path)
- Add a path to a global data file
- addListItems($path)
- Add the path to a list items data file
- addStyleguideAssetDirectory($path)
- Add a path to the list of styleguide asset directories
- setAnnotationsFile($path)
- Set the path to the annotations.js file
- setExposedOptions($options)
- Set the exposed options
- setHiddenControls($controls)
- Specify which controls should be hidden
- setIgnoredDirectories($directories)
- Specify which asset directories should be ignored
- setIgnoredExtensions($extensions)
- Specify which asset extensions should be ignored
- setPatternExtension($extension)
- Specify the extension of pattern template files (i.e. "twig")
- setPatternsDirectory($path)
- Specify the path of the directory that contains pattern templates
- setStyleguideFooter($path)
- Set the path to the styleguide footer template
- setStyleguideHeader($path)
- Set the path to the styleguide header template
- setStyleguideTemplatesDirectory($path)
- Specify the directory that contains the styleguide template files
- setTwigOptions($options)
- Specify options for the Twig parser