定制 trendyminds/craft-spacing 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

trendyminds/craft-spacing

最新稳定版本:2.0.0

Composer 安装命令:

composer require trendyminds/craft-spacing

包简介

A utility field to insert spacing between your Matrix blocks

README 文档

README

🤔 What is this?

Like our Design Tokens plugin, this is a Craft dropdown fieldtype where the options and the values are controllable via JSON files. However, it's highly specific if you use Matrix as a "page builder". This will render a "Top" and a "Bottom" dropdown in a single field and spare you from having to add two discrete spacing fields to every block one-by-one.

If you use Tailwind the JIT process only runs against Tailwind values it finds in your filesystem. If you have a class like h-12 in your database there's nothing Tailwind can do to find that (unless you enable Project Config, but do you really want Tailwind crawling your Project Config?).

Spacing allows you to define the values within JSON files on your filesystem, making it possible to use Tailwind's JIT process and provide a simple way to add and edit new values to your dropdowns.

⚠️ Careful, though!

Editing these JSON files means it's possible to break the output of your data. For example:

{
  "standard": "h-12",
+ "tighter": "h-6",
- "tight": "h-6",
  "none": "h-0"
}

Changing "tight" to "tighter" would break any entry using "tight"! Now when it tries to locate the value of "tight" it will come up empty until you've changed all of those values.

📝 Usage

To setup your spacing options, create a config/spacing.json file in your project.

{
  "standard": "h-12",
  "tight": "h-6",
  "none": "h-0"
}
{# Outputs the value of the selected top option (h-12, h-6, h-0) #}
{{ entry.mySpacingField.top }}

{# Outputs the value of the selected bottom option (h-12, h-6, h-0) #}
{{ entry.mySpacingField.bottom }}

{# Outputs the entire configuration in config/spacing.json #}
{{ entry.mySpacingField.config }}

📦 Installing

Install Spacing in one of two ways:

🤝 Contributing

If you'd like to contribute please submit a pull request for review. We try to review and accept contributions whenever possible!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: mit
  • 更新时间: 2023-04-25