1 Star 0 Fork 0

Raisr / ra-symbol-iconfont

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

@rasir/symbol-iconfont

介绍

自动将 svg 文件转成 ionfont.js,并且输出 React 的 Icon 组件,不兼容 IE。

使用方法

npm i @rasir/symbol-iconfont -g

API

  --id <id>             父元素id,默认与文件名同名,防止同一个iconfont文件重复创建父元素
  -c,--clazz            输出React class组件,默认是输出 React 函数组件
  -d,--deep             是否递归目录
  -p,--pure             是否去掉颜色
   -r,                   是否还原svg,将恢复所有symbols,-r的情况下,--pick/--remove/--add失效
  --restore <restore>   只恢复指定的svg文件,不修改原iconfont.js文件。指定要恢复的symbols名称,以逗号隔开,--restore有值的情况下,--pick/--remove/--add失效
  --add <add>           添加svg到output指定的iconfont文件中,指定要添加的svg所在的目录,如果有重复名称的svg会在在名称中添加数字
  --remove <remove>     指定symbols从iconfont文件中移除,指定要移除的symbols名称,以逗号隔开
  --pick <pick>         指定symbols从iconfont文件中恢复成svg文件并将对应的symbols从文件中删除,指定要移除的symbols名称,以逗号隔开
  --html                根据指定的 iconfont.js 生成模版 html
  -i,--input <input>    输入路径 默认当前目录
  -o,--output <output>  输出路径 默认/dist
  -h,--help             api说明
  -v,--version          版本信息

使用示例

bsicon --id=bdpicon -d -p -i=/asserts -o=/dist

输出结果

dist
    Icon
        index.tsx --- react 组件tsx
        index.less --- react 组件样式 less
    iconfont.js --- 包含所有svg信息的iconfont文件
    index.html --- iconfont 示例可以点击图标复制type

1.0.3

如果你想部分 svg 去除颜色,部分保留颜色。可以在 -i 指定的目录下再新建一个 pure 目录,将要去除颜色的 svg 放入其中,同时在命令行中不要使用-p 但是要加入-d。 如果命令行中加入了-p 那么产出会全部去除颜色。 如果命令行中没有-d 那么程序就不会读取 pure 目录。 例如:bsicon --id=bdpicon -d -i=/asserts -o=/dist

1.1.1

  1. 还原 svg 将 iconfont.js 还原为 svg 文件 bsion -r -i=/asserts/iconfont.js -o=/dist 也可以指定要还原的 svg 名称 bsion -i=/asserts/iconfont.js -o=/dist --restore=a,b,c 还原 svg 不会修改原 iconfont.js 也不会生成新的 iconfont.js

  2. 添加 svg 到 iconfont.js bsion -i=/asserts/iconfont.js -o=/dist --add=/dir bsion -i=/asserts/iconfont.js -o=/dist --add=/dir/new.svg

  3. 从 iconfont.js 中删除指定的 svg bsion -i=/asserts/iconfont.js -o=/dist --remove=a,b,c

  4. 从 iconfont.js 中恢复指定的 svg bsion -i=/asserts/iconfont.js -o=/dist --pick=a,b,c

  5. 根据 iconfont.js 生成模版 html bsion -i=/asserts/iconfont.js -o=/dist --html

MIT License Copyright (c) 2022 Raisr Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

自动将svg文件转成ionfont.js,并且输出React 的Icon组件。 展开 收起
JavaScript 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/rasir/ra-symbol-iconfont.git
git@gitee.com:rasir/ra-symbol-iconfont.git
rasir
ra-symbol-iconfont
ra-symbol-iconfont
master

搜索帮助