mariohamann/statamic-figma-assets
最新稳定版本:v1.2.0
Composer 安装命令:
composer require mariohamann/statamic-figma-assets
包简介
A Statamic addon to import assets from Figma.
README 文档
README
Statamic Figma Assets is an addon that allows you to import assets from Figma into your Statamic site.
Features
- 🎨 Import icons, illustrations, photos, and other assets from Figma
- 🗂️ Flexible configuration for asset container, format, size, and more
- 🔄 "Smart" Importing – import all assets or only new ones
- 🏎️ Optimized performance with batched generation pooled downloads
- 🛠️ Transformers for fine-grained filtering and naming of assets
- ♾️ Unlimited configurations for multiple Figma files, asset containers, formats etc.
Setup
You can install this addon via Composer:
composer require mariohamann/statamic-figma-assets
Once installed, head over to Utilities > Figma Assets in the Statamic control panel to start importing.
Configuration
Quick setup (via .env)
If you're fine with using the defaults, it's enough to set some configuration values in your .env file, for example:
FIGMA_TOKEN=fig_token-here FIGMA_FILE_ID=file-id-here FIGMA_PAGE_TITLE="🎉 Assets" FIGMA_FRAME_TITLE="Components" FIGMA_ASSETS_CONTAINER="assets" FIGMA_FORMAT="svg" FIGMA_SCALE=1 FIGMA_EXPORT_CHILDREN=true FIGMA_OPTIMIZE_VARIANT_NAMES=true FIGMA_BATCH_SIZE=100 FIGMA_DOWNLOAD_BATCH_SIZE=15
Advanced setup
For more advanced configuration and multiple configurations, you can publish the config file:
php artisan vendor:publish --provider="MarioHamann\StatamicFigmaAssets\ServiceProvider" --tag="config"
This will create a config/statamic-figma-assets.php file where you can set the default values for the addon.
From there, you can define multiple configurations and tweak every option to your needs.
Example configuration
return [ [ 'title' => 'SVG Icons', 'token' => env('FIGMA_TOKEN'), 'file_id' => env('FIGMA_FILE_ID'), 'page_title' => 'Marketing Assets', 'frame_title' => 'Logos', 'assets_container' => 'assets', 'format' => 'svg', 'scale' => 1, 'export_children' => true, 'optimize_variant_names' => true, 'assets_transformer' => null, 'figma_batch_size' => 100, 'download_batch_size' => 15, ] // ... more configurations ]
Example assets_transformer
The assets_transformer is a callable that allows you to filter and rename assets before they are fetched from Figma. It receives the asset data as an array and should return the modified data.
Here's an example that filters out assets starting with an underscore (e. g. _icon or icons/_icon):
return [ [ // ... other configuration options 'assets_transformer' => function ($assets) { $assets = array_filter( $assets, fn($asset) => !preg_match('/(^_|\/_)/', $asset['name']) ); return $assets; }, ], ];
Example before_upload
The before_upload callback allows you to modify the asset before it is uploaded to the Statamic assets container. This can be useful for optimizing images or performing other transformations.
Here we're using it to optimize SVG files using SVGO. If you want to use this, ensure to use the correct path to SVGO (e. g. via which svgo).
return [ [ // ... other configuration options 'before_upload' => function ($path) { exec("~/Library/pnpm/svgo $path"); return $path; }, ], ];
mariohamann/statamic-figma-assets 适用场景与选型建议
mariohamann/statamic-figma-assets 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 335 次下载、GitHub Stars 达 3, 最近一次更新时间为 2025 年 04 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「assets」 「addon」 「statamic」 「figma」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mariohamann/statamic-figma-assets 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mariohamann/statamic-figma-assets 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mariohamann/statamic-figma-assets 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Asset Management for PHP
Caching and compression for Twig assets (JavaScript and CSS).
Statamic Fine Seo addon
This composer plugin enables installation of GravityForms WordPress plugin and its addons.
Tool for loading or deploying CSS and JS files into web pages
统计信息
- 总下载量: 335
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-19