# @svgr/core

[![Build Status](https://img.shields.io/travis/smooth-code/svgr.svg?style=flat-square)](https://travis-ci.org/smooth-code/svgr) [![version](https://img.shields.io/npm/v/@svgr/core.svg?style=flat-square)](https://www.npmjs.com/package/@svgr/core) [![MIT License](https://img.shields.io/npm/l/@svgr/core.svg?style=flat-square)](https://github.com/smooth-code/svgr/blob/master/LICENSE)

Node API of SVGR.

```
npm install @svgr/core
```

## Usage

```js
import svgr from '@svgr/core'

const svgCode = `
<svg xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink">
  <rect x="10" y="10" height="100" width="100"
    style="stroke:#ff0000; fill: #0000ff"/>
</svg>
`

svgr(svgCode, { icon: true }, { componentName: 'MyComponent' }).then(jsCode => {
  console.log(jsCode)
})
```

Use `svgr.sync(code, config, state)` if you would like to use sync version.

### Plugins

By default `@svgr/core` doesn't include `svgo` and `prettier` plugins, if you want them, you have to install them and include them in config.

```js
svgr(svgCode, {
  plugins: ['@svgr/plugin-svgo', '@svgr/plugin-jsx', '@svgr/plugin-prettier'],
}).then(jsCode => {
  console.log(jsCode)
})
```

## License

MIT

```
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bryan-guner.gitbook.io/my-docs/redux/repos/examples/real-world/node_modules/svgr-9/core.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
