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: 3 months ago
JSON representation
Twig function that inserts static classes into Pattern Lab but adds them to attributes in Drupal
- Host: GitHub
- URL: https://github.com/drupal-pattern-lab/bem-twig-extension
- Owner: drupal-pattern-lab
- License: gpl-2.0
- Created: 2017-07-13T18:50:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-11-21T17:43:40.000Z (about 5 years ago)
- Last Synced: 2024-10-03T10:37:03.866Z (3 months ago)
- Language: PHP
- Size: 14.6 KB
- Stars: 14
- Watchers: 1
- Forks: 7
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- component-based-theming - bem-twig-extension
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:
`
`