Files
figma-templates-showcase/scripts/import-to-figma.sh
kang ee719d07cc feat: 初始化 Figma 模板库 56 套展示站
- 56 套模板元数据(35 Figma 原生 + 21 非 Figma)
- 静态展示站 (HTML/CSS/JS 无框架):格式筛选、lightbox、搜索
- 35 个 .fig 已真上传 Figma Drafts 云端
- iframe 实时投射(登录态可看私有 Drafts)
- 部署:nginx:alpine + basic-auth (kang)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 15:31:45 +08:00

42 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Batch open .fig files in Figma desktop app (→ Drafts)
# Mode: "all" (72 files) or "slim" (W37 only 1, rest all = 48 files)
set -euo pipefail
MODE="${1:-slim}"
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
python3 - "$MODE" <<'PY' > /tmp/fig-list.txt
import json, sys, os
mode = sys.argv[1]
m = json.load(open("manifest.json"))
already_opened = {"W1"} # already done in earlier test
files = []
for t in m["templates"]:
if not t["fig"]: continue
figs = list(t["fig"])
if mode == "slim" and t["id"] == "W37":
figs = figs[:1]
for f in figs:
path = f'extracted/{t["id"]}/{f}'
if t["id"] in already_opened and figs.index(f) == 0 and t["id"] == "W1":
continue # skip W1 first fig (already opened)
files.append(path)
print('\n'.join(files))
PY
count=$(wc -l < /tmp/fig-list.txt | tr -d ' ')
echo "Mode=$MODE Files to open: $count"
echo ""
i=0
while IFS= read -r f; do
i=$((i+1))
printf "[%2d/%d] %s\n" "$i" "$count" "$f"
open -a Figma "$ROOT/$f"
sleep 1.5
done < /tmp/fig-list.txt
echo ""
echo "Done. All $count .fig files sent to Figma."