codeat3/blade-icon-generation-helpers
Composer 安装命令:
composer require codeat3/blade-icon-generation-helpers
包简介
codeat3's helper methods to use in blade-icon generation scripts
README 文档
README
A helper package to convert the icons to make it compatible to be used with the blade-icons package.
Installation
composer require codeat3/blade-icon-generation-helpers
Usage
Kindly refer the Generating Icons section from Blade Icons. This Package utilizes the after callback to process the icons as per our need.
The after callback received 3 arguments string $icon - this is the pathname of the icon, array $config - the config specified in the generation.php & SplFileInfo $file - the original icon file instance.
Inside a callback we instantiate our Processor class & use its helper methods to our benefit.
$iconProcessor = new IconProcessor($icon, $config, $sourceFile);
This IconProcessor instance itself does some optimization on its own by default. Minimal usage would be as follows.
$iconProcessor = new IconProcessor($icon, $config, $sourceFile); $iconProcessor ->optimize() ->save();
The optimize method does the following things by default:
- it removes the following attributes from the svg
- 'width', 'height', 'class', 'style', 'id',
- if in the config provided
is-outlineis set astrue- if
fillattribute exists - it will updated tonone - if
strokeattribute exists - it will updated tocurrentColor
- if
- if in the config provided
is-solidis set astrue- if
fillattribute exists - it will updated tocurrentColor
- if
- if in the config provided
custom-attributesis set`- it will set the attributes to the svg
- optionally it provides 2 callable methods
pre&post- both callback receives the
$svgELas theDOMDocument- its the DOMDocument instance of the current icon precan be used if you have to perform some operation before Processor does the default processingpostcan be used if you have to perform some operation after Processor does the default processing
- both callback receives the
The save method
codeat3/blade-icon-generation-helpers 适用场景与选型建议
codeat3/blade-icon-generation-helpers 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 77.8k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 06 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 codeat3/blade-icon-generation-helpers 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 codeat3/blade-icon-generation-helpers 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 77.8k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 22
- 依赖项目数: 59
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-06-30