# nicon-toolkit

> an util that get iconfont source from nicon

Latest version **1.0.2** (published 2018-03-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install nicon-toolkit
pnpm add nicon-toolkit
yarn add nicon-toolkit
bun add nicon-toolkit
```

Provides the command `nicon-toolkit`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-03-17 |
| First published | 2018-03-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 7 |
| Author | liaobolin |
| Maintainers | liaobolin |
| Keywords | icon, nicon-toolkit, icon tool |

## Links

- npm: https://www.npmjs.com/package/nicon-toolkit
- Repository: https://github.com/bolin-L/nicon-toolkit
- Homepage: https://github.com/bolin-L/nicon-toolkit#readme
- Issues: https://github.com/bolin-L/nicon-toolkit/issues
- npm.io page: https://npm.io/package/nicon-toolkit

## Dependencies (4)

- [axios](https://npm.io/package/axios.md) ^0.17.1
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [rimraf](https://npm.io/package/rimraf.md) ^2.6.2
- [commander](https://npm.io/package/commander.md) ^2.13.0

## Alternatives

- [@fortawesome/react-fontawesome](https://npm.io/package/@fortawesome/react-fontawesome.md) — 2.2M weekly downloads
- [roboto-fontface](https://npm.io/package/roboto-fontface.md) — 196.0K weekly downloads
- [@react-native-vector-icons/common](https://npm.io/package/@react-native-vector-icons/common.md) — 150.4K weekly downloads
- [@procore/core-icons](https://npm.io/package/@procore/core-icons.md) — 4.6K weekly downloads
- [@react-md/material-icons](https://npm.io/package/@react-md/material-icons.md) — 1.6K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-03-17
- 1.0.1 — 2018-03-17
- 1.0.0 — 2018-03-08

## README

<div align="center">
  <a href="http://icon.bolin.site" target="_blank">
    <img width="200" heigth="200" src="http://edu-image.nosdn.127.net/c76721ab-86ac-4c59-88c4-5a2468c578a5.png">
  </a>
  <br>
  <p align="left">
    nicon-toolkit is a util that fetches iconfont resource from nicon platform. Its main purpose is to reduce complication for usage when fetching iconfont resource from nicon platform
  <p>
</div>

## Install

```bash
npm install -g nicon-toolkit
```

## Getting Start

### Using a Configuration

Most projects will need a more complex setup, so nicon-toolkit supports a [configuration file](https://github.com/berlin-L/nicon-toolkit/blob/master/icon.config.example.js). This is more convenient and efficient that having to type in a lot of commands in the terminal.

**your project**

```
your-project
    | - bin
    | - src
    | - package.json
  + | - icon.config.js
    | - index.html
```

**icon.config.js**

```javascript
module.exports = [{
    "repoId": "37",
    "type": "cssUrl",
    "output": "./index.html",
    "tag": 'regex',
    "apiUrl": 'http://icon.bolin.site/api/repo/{repoId}/resource'
}]
```

### add a placeholder to your output file

```html
<link  name="cssUrl" href="replaceContent">
```

### Run command in terminal under your-project root path

```text
nicon-toolkit
```

### Finish

get  below

```html
<link  name="cssUrl" href="//nos.netease.com/icon/dd7a8e7d8f00054c45e50c4e6c3778e8.css">
```

## Configuration

|Type|repoId|output|[tag]|[placeholder]|[apiUrl]|
|:--:|:----:|:----:|:--:|:---:|:--:|
|cssUrl|Number|file path|tag.cssUrl|palceholder.cssUrl| apiUrl.default |
|cssContent|Number|file path|tag.cssContent|palceholder.cssContent|apiUrl.default|
|cssFile|Number|file path|-|-|apiUrl.default|
|svg|Number|folder path|-|-|apiUrl.default|
|svgSpriteContent|Number|file path|tag.svgSpriteContent |palceholder. svgSpriteContent |apiUrl.default|

## default config
### apiUrl
default

```
http://icon.bolin.site/api/repo/{repoId}/resource
```

### tag
cssUrl

```
/<link(\s+rel="stylesheet")*\s+name="cssUrl"\s+href="(.*?)">/gm
```

cssContent

```
/<style(\s+type="text\/css")*\s+name="cssContent">((.|\t|\n)*?)<\/style>/gm
```
svgSpriteContent

```
/<div(\s+type="svgSprite")*\s+name="svgSpriteContent">((.|\t|\n)*?)<\/div>/gm
```

### placeholder
cssUrl

```
<link  name="cssUrl" href="replaceContent">
```

cssContent

```html
<style  name="cssContent">replaceContent</style>

```

svgSpriteContent

```html
<div name="svgSpriteContent">replaceContent</div>
```

## Nofice
if you want to use your `tag` property, You must follow the rules below

```
fileContent.replace(tag, function ($0, $1, $2) {
    return $0.replace($2, content);
});
```

---
_Source: https://npm.io/package/nicon-toolkit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
