korcontrol/craft-classy 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

korcontrol/craft-classy

最新稳定版本:3.0.0-rc1

Composer 安装命令:

composer require korcontrol/craft-classy

包简介

Twig helpers inspired by https://github.com/JedWatson/classnames

关键字:

README 文档

README

Twig helpers inspired by https://github.com/JedWatson/classnames

Usage

Filter

{% apply class(
  "add-this-initially",
  {
    "add-this": true,
    "remove-this": false,
    "neither-add-nor-remove": null,
    "add-or-remove": ifthis and ifthat,
    "add-but-dont-remove": condition ? true : null,
    "remove-but-dont-add": not condition ? false : null,
  },
  "add-this-regardless-of-above",
) %}
  <mytag class="existing classes"> ... </mytag>
{% endapply %}

Function

<mytag class="{{ class("yup yes", { "maybe": ifthis and ifthat }) }}">

Which depending on the conditions ifthis and ifthat will give

<mytag class="yup yes maybe"> or <mytag class="yup yes">

Each argument can be either a string or a map.

A string argument will be treated as a class name (or multiple space-separated class names) to add.

An array argument is a map of class names to statuses.

Its keys are single class names or groups of space-seprated classes. The corresponding values can be

  • strictly true to add the class or classes
  • strictly false to remove the class or classes
  • null or anything else to leave them alone

Any existing classes which aren't mentioned in any of these arguments are left alone.

Arguments are processed in order.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-03-23