# gulp-nano

> SVG files compression tool for Nano. More information in [Nano](https://vecta.io/nano)

Latest version **1.0.7** (published 2019-05-23) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install gulp-nano
pnpm add gulp-nano
yarn add gulp-nano
bun add gulp-nano
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2019-05-23 |
| First published | 2019-05-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 6.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Thomas Yip |
| Maintainers | neel.radica, weiluo.radica, yan.radica, yiqian.radica |

## Links

- npm: https://www.npmjs.com/package/gulp-nano
- Repository: https://github.com/vecta-io/gulp-nano
- Homepage: https://vecta.io/nano
- Issues: https://github.com/vecta-io/gulp-nano/issues
- npm.io page: https://npm.io/package/gulp-nano

## Dependencies (3)

- [vinyl](https://npm.io/package/vinyl.md) ^2.2.0
- [nanosvg](https://npm.io/package/nanosvg.md) ^1.0.8
- [through2-concurrent](https://npm.io/package/through2-concurrent.md) ^2.0.0

## Recent versions

- 1.0.7 (latest) — 2019-05-23
- 1.0.6 — 2019-05-23
- 1.0.5 — 2019-05-23
- 1.0.3 — 2019-05-16
- 1.0.2 — 2019-05-15
- 1.0.1 — 2019-05-15
- 1.0.0 — 2019-05-08

## README

![Nano](logo.png)

[![npm version](https://badge.fury.io/js/gulp-nano.svg)](https://badge.fury.io/js/gulp-nano)

Gulp plugin for SVG files compression using Nano. For more information, visit [Nano](https://vecta.io/nano)

## Installation

`npm install gulp-nano`

## Authentication

Obtain API Key in [Nano](https://vecta.io/nano)

## Usage

```javascript
var gulp = require('gulp'),
    nano = require('gulp-nano');

gulp.task('Compress SVG', function () {
    return gulp.src('./*.svg')
        .pipe(nano({ key: 'YOUR API KEY', embed_fonts: 1 }))
        .pipe(gulp.dest('./compressed/'));
});
```

## Usage with gulp-cache

```javascript
var gulp = require('gulp'),
    cache = require('cache'), //cache compressed svg
    nano = require('gulp-nano');

gulp.task('Compress SVG', function () {
    return gulp.src('./*.svg')
        .pipe(cache(
            nano({ key: 'YOUR API KEY', embed_fonts: 1 }), { name: 'nano-cache' } )
        .pipe(gulp.dest('./compressed/'));
});
```

### Options

`key <string>` 

- API key obtained from [Nano](https://vecta.io/nano)

`precision=3 <number>`

- Precision of numerical values in SVG.

`embed_fonts=1 <number|boolean>`

- Fonts embedding in SVG. Useful when svg is referenced using <img>. Defaults to `1` or `true`

`maintain_class=0 <number|boolean>`

- Maintain class name of SVG elements. Defaults to `0` or `false`
- Example:

```html
<!--Before-->
<svg>
    <rect class="Fill" x="0" y="0" width="100" height="100"></rect>
</svg>

<!--After-->
<svg>
    <path class="Fill" d="M 0 0 L 100 100" />
</svg>
```

`maintain_id=0 <number|boolean>`

- Maintain id of SVG elements. Defaults to `0` or `false`
- Example:

```html
<!--Before-->
<svg>
    <rect id="rect1" x="0" y="0" width="100" height="100"></rect>
</svg>

<!--After-->
<svg>
    <path id="rect1" d="M 0 0 L 100 100" />
</svg>
```

`maintain_structure=0 <number|boolean>`

- Maintain structure of SVG elements. Defaults to `0` or `false`

## License

This software is licensed under the MIT License. [View the license](LICENSE).

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