返回顶部
f

flexFlex布局

Generate CSS Flexbox layouts using interactive CLI commands. Use when building responsive flex containers, rows, columns, or alignment configurations.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
173
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

flex

Flex — CSS Flexbox 布局生成器

一个用于生成 CSS Flexbox 布局的命令行工具。创建弹性容器,配置对齐、排列、换行、间距和顺序属性,然后导出可直接用于生产的 CSS 代码。

前置条件

  • - Python 3.8+
  • bash shell
  • 对 ~/.flex/ 目录的写入权限

数据存储

所有布局配置均以 JSONL 格式存储在 ~/.flex/data.jsonl 中。每条记录代表一个已保存的弹性布局及其所有属性。

命令

通过以下方式运行命令:bash scripts/script.sh [arguments...]

create

创建一个新的弹性容器布局,可指定名称和可选初始属性。

bash
bash scripts/script.sh create --name navbar --direction row --items 5
bash scripts/script.sh create --name sidebar --direction column

参数:

  • - --name — 布局名称(必填)
  • --direction — 弹性方向:row、column、row-reverse、column-reverse(可选,默认值:row)
  • --items — 子元素数量(可选,默认值:3)

row

创建一个快速水平行布局预设。

bash
bash scripts/script.sh row --name header-row --items 4
bash scripts/script.sh row --name card-grid --gap 16

参数:

  • - --name — 布局名称(必填)
  • --items — 元素数量(可选,默认值:3)
  • --gap — 间距(像素)(可选,默认值:0)

column

创建一个快速垂直列布局预设。

bash
bash scripts/script.sh column --name sidebar-nav --items 6

参数:

  • - --name — 布局名称(必填)
  • --items — 元素数量(可选,默认值:3)
  • --gap — 间距(像素)(可选,默认值:0)

wrap

切换或设置现有布局的 flex-wrap 属性。

bash
bash scripts/script.sh wrap --id --value wrap
bash scripts/script.sh wrap --id --value nowrap

参数:

  • - --id — 布局 ID(必填)
  • --value — 换行值:wrap、nowrap、wrap-reverse(可选,默认值:wrap)

align

设置布局的 align-items 属性。

bash
bash scripts/script.sh align --id --value center

参数:

  • - --id — 布局 ID(必填)
  • --value — 对齐方式:flex-start、flex-end、center、stretch、baseline(必填)

justify

设置布局的 justify-content 属性。

bash
bash scripts/script.sh justify --id --value space-between

参数:

  • - --id — 布局 ID(必填)
  • --value — 排列方式:flex-start、flex-end、center、space-between、space-around、space-evenly(必填)

gap

设置布局的 gap 属性。

bash
bash scripts/script.sh gap --id --value 16
bash scripts/script.sh gap --id --row 8 --column 16

参数:

  • - --id — 布局 ID(必填)
  • --value — 间距(像素)(可选)
  • --row — 行间距(像素)(可选)
  • --column — 列间距(像素)(可选)

order

设置布局中特定子元素的 order 属性。

bash
bash scripts/script.sh order --id --item 2 --value -1

参数:

  • - --id — 布局 ID(必填)
  • --item — 元素索引,从 1 开始(必填)
  • --value — 顺序值(必填)

grow

设置子元素的 flex-grow 属性。

bash
bash scripts/script.sh grow --id --item 1 --value 2

参数:

  • - --id — 布局 ID(必填)
  • --item — 元素索引(必填)
  • --value — 弹性增长值(必填)

shrink

设置子元素的 flex-shrink 属性。

bash
bash scripts/script.sh shrink --id --item 3 --value 0

参数:

  • - --id — 布局 ID(必填)
  • --item — 元素索引(必填)
  • --value — 弹性收缩值(必填)

export

将单个布局或所有布局导出为 CSS 代码。

bash
bash scripts/script.sh export --id
bash scripts/script.sh export --all --output layouts.css

参数:

  • - --id — 导出特定布局(可选)
  • --all — 导出所有布局(可选)
  • --output — 输出文件路径(可选,默认值:标准输出)

help

显示帮助信息并列出所有可用命令。

bash
bash scripts/script.sh help

version

显示当前工具版本。

bash
bash scripts/script.sh version

示例

bash

创建导航栏


bash scripts/script.sh create --name navbar --direction row --items 5
bash scripts/script.sh justify --id abc123 --value space-between
bash scripts/script.sh align --id abc123 --value center
bash scripts/script.sh export --id abc123

快速卡片网格

bash scripts/script.sh row --name cards --items 4 --gap 16 bash scripts/script.sh wrap --id def456 --value wrap

导出所有内容

bash scripts/script.sh export --all --output flex-layouts.css

说明

  • - 每个布局存储完整的弹性属性:方向、换行、对齐、排列、间距以及每个元素的增长/收缩/顺序
  • export 命令生成干净、可直接用于生产的 CSS 代码,类名源自布局名称
  • 使用 row 和 column 快捷方式替代 create 处理常见模式
  • 元素属性(增长、收缩、顺序)按每个布局中的元素索引存储

由 BytesAgain 提供支持 | bytesagain.com | hello@bytesagain.com

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 flex-1776169742 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 flex-1776169742 技能

通过命令行安装

skillhub install flex-1776169742

下载

⬇ 下载 flex v1.0.0(免费)

文件大小: 4.95 KB | 发布时间: 2026-4-17 14:51

v1.0.0 最新 2026-4-17 14:51
publish v1.0.0

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部