# @factorial/stack-svg

> This is the SVG plugin for `@factorial/stack-core`.

Latest version **0.2.2** (published 2023-02-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @factorial/stack-svg
pnpm add @factorial/stack-svg
yarn add @factorial/stack-svg
bun add @factorial/stack-svg
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2023-02-24 |
| First published | 2020-09-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 9.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Michael Großklaus |
| Maintainers | dnnsjrng, mmatull, mlnmln, mgrsskls, andrewbeng89, krisimmig |

## Links

- npm: https://www.npmjs.com/package/@factorial/stack-svg
- Repository: https://github.com/factorial-io/fstack
- Homepage: https://github.com/factorial-io/fstack#readme
- Issues: https://github.com/factorial-io/fstack/issues
- npm.io page: https://npm.io/package/@factorial/stack-svg

## Dependencies (3)

- [svgo](https://npm.io/package/svgo.md) ^3.0.2
- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [svg-sprite](https://npm.io/package/svg-sprite.md) ^2.0.2

## Recent versions

- 0.2.2 (latest) — 2023-02-24
- 0.2.1 — 2022-11-29
- 0.2.0 — 2022-10-04
- 0.1.18 — 2022-05-03
- 0.1.17 — 2022-03-08
- 0.1.16 — 2022-02-05
- 0.1.15 — 2022-02-03
- 0.1.14 — 2021-11-08
- 0.1.13 — 2021-08-25
- 0.1.11 — 2021-08-24
- 0.1.10 — 2021-08-16
- 0.1.9 — 2021-07-01
- 0.1.8 — 2021-06-23
- 0.1.7 — 2021-06-17
- 0.1.6 — 2021-04-30
- … 6 more at https://npm.io/package/@factorial/stack-svg/versions

## README

# @factorial/stack-svg

This is the SVG plugin for `@factorial/stack-core`.

It adds

- a optimization task using
  - [svgo](https://www.npmjs.com/package/svgo)
- a sprite task using
  - [svg-sprite](https://www.npmjs.com/package/svg-sprite)

## Installation

You can install it via:

```bash
yarn factorial init
```

or manually via:

```bash
yarn add @factorial/stack-svg
```

Make sure it is added to your `.factorialrc.js` like this:

```js
// .factorialrc.js

module.exports = {
  use: [require("@factorial/stack-svg")],
};
```

## Usage

In your `.factorialrc.js` add a `svgFolders` key with an array of folders that contain your SVG files:

```js
// .factorialrc.js

module.exports = {
  svgFolders: ["icons"], // relative to your rootFolder
};
```

### optimize

```bash
yarn factorial optimize
```

This task will go over all SVG files found in your svg folders and optimize them (remove unnecessary attributes, whitespace, etc.).

_**NOTE:** This tasks overwrites your SVG files!_

### sprite

```bash
yarn factorial sprite
```

This task will create a SVG sprite for each of your svg folders. If you e.g. have a svg folder `src/svgs/icons`, it will create `src/svgs/icons.sprite.svg`.

If you have multiple svg folders, you can also create just a single sprite via:

```bash
yarn factorial sprite --folder path/to/your/folder
```

The path to your folder would be relative from your working directory.

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