Skip to content

Commit

Permalink
Finish documentation in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ddamato committed Jun 10, 2020
1 parent d75b32b commit a2ba112
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ When providing a function, the input will be SVG asset string which may transfor

### `createSymbols(pathOrObject)`

This method takes a single argument, either a path to SVG files or an object where the keys are asset names (used for look up) and the value is a SVG XML string (`<svg></svg>`). When using the directory path, the file name will become the asset name.

This method is also available as a named export from the package. You can use this if you have your own processing step before preparing the SVG files, perhaps with something like [SVGO](https://github.com/svg/svgo).

```js
const { createSymbols } = require('savager');

const savagerSymbols = createSymbols('path/to/svg');
console.log(savagerSymbols); // { balloon: '<svg><symbol>...</symbol></svg>' }
```

## CLI
The `create-symbols` script targets a directory of `.svg` assets and prepares the necessary files for working with Savager. It uses the [`createSymbols` API method](createSymbols(pathOrObject)) under the hood.

Expand Down

0 comments on commit a2ba112

Please sign in to comment.