承接 drupal-pattern-lab/bem-twig-extension 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

drupal-pattern-lab/bem-twig-extension

最新稳定版本:v1.0.1

Composer 安装命令:

composer require drupal-pattern-lab/bem-twig-extension

包简介

Twig function that inserts static classes into Pattern Lab and adds them to the Attributes object in Drupal

README 文档

README

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 module can be helpful for that.

Usage (4 arguments)

Simple block name (required argument):

<h1 {{ bem('title') }}>

This creates:

<h1 class="title">

Block with modifiers (optional array allowing multiple modifiers):

<h1 {{ bem('title', ['small', 'red']) }}>

This creates:

<h1 class="title title--small title--red">

Element with modifiers and blockname (optional):

<h1 {{ bem('title', ['small', 'red'], 'card') }}>

This creates:

<h1 class="card__title card__title--small card__title--red">

Element with blockname, but no modifiers (optional):

<h1 {{ bem('title', '', 'card') }}>

This creates:

<h1 class="card__title">

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

<h1 {{ bem('title', ['small', 'red'], 'card', ['js-click', 'something-else']) }}>

This creates:

<h1 class="card__title card__title--small card__title--red js-click something-else">

Element with extra classes only (optional):

<h1 {{ bem('title', '', '', ['js-click']) }}>

This creates:

<h1 class="title js-click">

统计信息

  • 总下载量: 465.29k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 14
  • 点击次数: 1
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 14
  • Watchers: 0
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-08-17