# grunt-svg-toolkit

> > A toolkit for working with, styling and converting SVG files

Latest version **0.1.1** (published 2015-05-06) · 0 weekly downloads

## Install

```sh
npm install grunt-svg-toolkit
pnpm add grunt-svg-toolkit
yarn add grunt-svg-toolkit
bun add grunt-svg-toolkit
```

## 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.1.1 |
| Published | 2015-05-06 |
| First published | 2015-01-20 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 83 |
| Author | Iconic |
| Maintainers | iconic |
| Keywords | SVG, Scalable Vector Graphics, CSS, style, colorize, icons, automation, png, raster |

## Links

- npm: https://www.npmjs.com/package/grunt-svg-toolkit
- Repository: https://github.com/iconic/grunt-svg-toolkit
- Issues: https://github.com/iconic/grunt-svg-toolkit/issues
- npm.io page: https://npm.io/package/grunt-svg-toolkit

## Dependencies (5)

- [async](https://npm.io/package/async.md) ^0.9.0
- [chalk](https://npm.io/package/chalk.md) ^0.5.1
- [cheerio](https://npm.io/package/cheerio.md) ^0.18.0
- [phantom](https://npm.io/package/phantom.md) ^0.7.2
- [grunt-contrib-clean](https://npm.io/package/grunt-contrib-clean.md) ^0.6.0

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2015-05-06
- 0.1.0 — 2015-01-20

## README

# grunt-svg-toolkit

**A toolkit for working with, styling and converting SVG files.**

SVG Toolkit helps you work with SVG files by normalizing, colorizing, styling and optionally converting them to other formats, ready for production use.

A few example uses:

* Create colorized SVGs and PNGs across an entire SVG icon set. Colors in your design changing? No problem... update your grunt file and re-run. Done. No need to open your design tools to update and re-export all your assets.

* Use a CSS file to generate customized, themed SVG and PNG output assets. 

* SVG markup cleanup and normalization, decreasing asset size and increasing performance.

Vector workflow powerup ProTip:

> SVG Toolkit works great with the output generated from our [Illustrator SVG Exporter](https://github.com/iconic/illustrator-svg-exporter)!

## Getting Started
This plugin requires Grunt `~0.4.0`

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

### Install

```shell
npm install --save-dev grunt-svg-toolkit
```

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

```js
grunt.loadNpmTasks('grunt-svg-toolkit');
```


## svgtoolkit task
_Run this task with the `grunt svgtoolkit` command._

Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide.

### Usage

#### Gruntfile Configuration

```
svgtoolkit: {
  dist: {
    options: {
      generatePNGs: true,
      style: 'src/css/themes/blue.css',
      colorize: '#808000',
      debug: false
    },
    files: [
      {
        expand: true,
        cwd: 'src/icons/',
        src: '**/*.svg',
        dest: 'dist/icons'
      }
    ]
  }
```

#### Options

##### generatePNGs
Type: `Boolean`  
Default: **true**

Should PNGs be generated.

##### style
Type: `String`  
Default: undefined

The location of a CSS file that should be applied to the SVG files. Great for creating a theme across an icon set and generating a matching set of SVGs/PNGs.

##### colorize
Type: `String`  
Default: undefined

Define a hex color value (e.g. #d8dfd8) or HTML color name (e.g. thistle) to colorize the SVG files by setting their `stroke` and `fill` attributes. Great for colorizing a set of icons.

> Note: The `colorize` setting, if set, will override the `style` setting.

##### debug
Type: `Boolean`  
Default: **false**

Log task progress and details about the processing of each SVG.


## Known Issues

* SVG files with external font imports don't generate PNGs using those fonts currently. This will supposedly work in the upcoming [PhantomJS 2](https://github.com/ariya/phantomjs/wiki/PhantomJS-2), which has better font handling. Reference: https://github.com/ariya/phantomjs/issues/10592

```
<defs>
    <style>
        @import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700);
    </style>
</defs>
```

## Contributing

Your feedback is most welcome.

Have a troublesome SVG you are using that isn't generating the output you'd expect? Open an [issue](https://github.com/iconic/grunt-svg-toolkit/issues) with the details and include the SVG markup for us to test with.

Have an awesome idea for a new feature or additional output format that would be useful? Create a [`feature request` issue](https://github.com/iconic/grunt-svg-toolkit/labels/feature%20request) describing it, or even better... send a [pull request](https://github.com/iconic/grunt-svg-toolkit/pulls)!

Bugs? You know what to [do](https://github.com/iconic/grunt-svg-toolkit/issues).

## Background

This project is the result of abstracting and generalizing the icon production process tools used in building [Iconic](https://useiconic.com/), and to open source those pieces that might be more widely useful and applicable to the design and development communities. 

## Release History

### v0.1.0 (01/20/2015)
- Initial release

## License
Copyright (c) 2015 Waybury, contributors. Licensed under the MIT license.

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