Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/drupal-pattern-lab/bem-twig-extension

Twig function that inserts static classes into Pattern Lab but adds them to attributes in Drupal
https://github.com/drupal-pattern-lab/bem-twig-extension

Last synced: 27 days ago
JSON representation

Twig function that inserts static classes into Pattern Lab but adds them to attributes in Drupal

Lists

README

        

# bem-twig-extension
Twig function that inserts static classes into Pattern Lab and adds them to the Attributes object in Drupal

## Requirements

To use in Pattern Lab, simply place in the `_twig-components/functions` directory. Drupal needs to recognize the Twig function, so something like [Unified Twig Extensions](https://github.com/drupal-pattern-lab/unified-twig-extensions/) module can be helpful for that.

## Usage (4 arguments)

#### Simple block name (required argument):
`

`

This creates:

`

`

#### Block with modifiers (optional array allowing multiple modifiers):
`

`

This creates:

`

`

#### Element with modifiers and blockname (optional):
`

`

This creates:

`

`

#### Element with blockname, but no modifiers (optional):

`

`

This creates:

`

`

#### Element with modifiers, blockname and extra classes (optional - in case you need non-BEM classes):

`

`

This creates:

`

`

#### Element with extra classes only (optional):

`

`

This creates:

`

`