import-icon
v0.0.9
Published
Import font icon library file
Downloads
35
Readme
import icon
引入svg图标所需要的js和css文件
安装
npm安装:
npm install import-icon使用
在项目根目录新建一个配置文件icon.config.json
参数
- baseUrl: 图标库地址
- localPath: 保存图标文件的本地相对路径,若为空,则不下载图标文件,直接引入线上文件
- cssIcons: 需要引入的css图标库名称
- jsIcons: 需要引入的js图标库名称
- htmlPath: index.html文件的相对路径
- assetBasePath: 引入图标库(script或link标签)的base路径,默认为"/"
{
"baseUrl": "https://icon.tiansc.top/api/fonts/",
"localPath": "public/",
"cssIcons": [],
"jsIcons": ["dibicon"],
"htmlPath": "index.html",
"assetBasePath": "/"
}配置package.json,新增命令
{
"scripts": {
"icon": "import-icon"
}
}执行npm命令
npm run icon