# @liip/npm-icons

> Import svg icons using cli

Latest version **1.0.0** (published 2022-05-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @liip/npm-icons
pnpm add @liip/npm-icons
yarn add @liip/npm-icons
bun add @liip/npm-icons
```

Provides the command `icons`.

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-05-25 |
| First published | 2022-05-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 7 |
| Unpacked size | 17 KB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| Author | Renato Moor |
| Maintainers | renatomoor |
| Keywords | icons, liip, cli |

## Links

- npm: https://www.npmjs.com/package/@liip/npm-icons
- Repository: https://github.com/liip/npm-icons
- Homepage: https://liip.github.io/npm-icons/website/
- Issues: https://github.com/liip/npm-icons/issues
- npm.io page: https://npm.io/package/@liip/npm-icons

## Dependencies (7)

- [axios](https://npm.io/package/axios.md) ^0.27.2
- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [dotenv](https://npm.io/package/dotenv.md) ^16.0.1
- [prompts](https://npm.io/package/prompts.md) ^2.4.2
- [slugify](https://npm.io/package/slugify.md) ^1.6.5
- [commander](https://npm.io/package/commander.md) ^9.2.0
- [cosmiconfig](https://npm.io/package/cosmiconfig.md) ^7.0.1

## 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.0 (latest) — 2022-05-25
- 0.3.2 — 2022-05-25
- 0.3.0 — 2022-05-24
- 0.2.5 — 2022-05-24
- 0.2.4 — 2022-05-24
- 0.2.3 — 2022-05-24
- 0.2.2 — 2022-05-23
- 0.2.1 — 2022-05-23
- 0.2.0 — 2022-05-19
- 0.1.11 — 2022-05-19
- 0.1.10 — 2022-05-19
- 0.1.9 — 2022-05-19

## README

## [Official Documentation](https://liip.github.io/npm-icons/website)

To get started quickly you can add `liip-npm-icons` dependency to your project:

```bash
npm install @liip/npm-icons
```

Then create a config file `.npm-iconsrc.json`
and where you want to download your icons
```json[.npm-iconsrc.json]
{
  "iconsPath": "./src/assets/icons",
}
```


## Extended configuration
You would need to add the following variable to your `.npm-iconsrc.json`
```json[.npm-iconsrc.json]
{
  "iconsPath": "./src/assets/icons",
  "iconsSvgBaseUrl": "https://icons.liip.ch/icons",
  "iconsJsonUrl": "https://icons.liip.ch/icons.json",
  "iconsTypes": ["regular", "light"],
  "authorization": {
    "username": null,
    "password": null
  }
}
```
In case you want to add the username and password as environment variable you can use:

```.dotenv
ICONS_AUTH_USERNAME="yourUsername"
ICONS_AUTH_PASSWORD="yourPassword"
```

### Basic command use
```bash
npx icons add <icon-name>
```

### import icons from icons list file
File required one icon name per line  
File example (icons-list.txt):
```text
house
shop
music-ticket
```

command example:
```bash
npx icons add -l icons-list.txt
```
## Vue 3 integration

Requirements: 
 - Vue 3
 - Vite

 1. First we need to install vite-svg-loader to be able to use svg files as vue components:
```bash
npm install vite-svg-loader --save-dev
```
 2. Add svgLoader to `vite.config.js`
```javascript[vite.config.js]
import svgLoader from 'vite-svg-loader'

export default defineConfig({
  plugins: [vue(), svgLoader()]
})
```
 4. Add the vue icon component `BaseIcon`
```javascript
import { createApp } from 'vue'
import App from './App.vue'
import BaseIcon from '@liip/npm-icons'

createApp(App)
  .use(BaseIcon)
  .mount('#app')
```

 5. Use the baseIcon component passing the icon name
```vue
<template>
  <BaseIcon name="house" />
</template>
```

 6. (Optional) In case your icons are not located on- `/src/assets/icons`
```vue
<template>
  <BaseIcon name="house" iconsPath="/different/icons/path" />
</template>
```

## Contribute
To contribute first clone the project:
```bash
git clone git@github.com:liip/npm-icons.git
```

### Release
The tool release-it is used to make a release
so it is as simple as running the following command:
```bash
npm run release 
```

### Update documentation
Our documentation is made with nuxt-content and the docs theme
If you want to make any changes you need execute the following commands:
```bash
cd docs
npm install
npm run dev
```

#### Deployment
The deployment is made with github pages using static files thanks to 
nuxt generate.
If you want to deploy some changes just run `npm run release` and 
then answer yes to the question `Do you want to build the docs?`
then release-it will run `nuxt generate` and commit the changes into the 
tag commit.

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