# stencil-inline-svg

> A Stenciljs plugin to insert inline SVGs into components

Latest version **1.1.0** (published 2021-06-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install stencil-inline-svg
pnpm add stencil-inline-svg
yarn add stencil-inline-svg
bun add stencil-inline-svg
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2021-06-07 |
| First published | 2019-02-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 26 |
| Author | Fabricio Rodrigues |
| Maintainers | fabriciomendonca |
| Keywords | stencil, plugin, svg, inline |

## Links

- npm: https://www.npmjs.com/package/stencil-inline-svg
- Repository: https://github.com/fabriciomendonca/stencil-inline-svg
- Homepage: https://github.com/fabriciomendonca/stencil-inline-svg#readme
- Issues: https://github.com/fabriciomendonca/stencil-inline-svg/issues
- npm.io page: https://npm.io/package/stencil-inline-svg

## Recent versions

- 1.1.0 (latest) — 2021-06-07
- 1.0.1 — 2019-09-30
- 1.0.0 — 2019-09-17
- 0.0.2 — 2019-02-28

## README

# stencil-inline-svg

A Stenciljs plugin to insert inline SVGs into components on build time.

> Requires stenciljs version ^1.4.0 - `"@stencil/core": "^1.4.0"`

## Installation

```bash
npm install -D stencil-inline-svg
```

## Usage

Import the plugin on your `stencil.config.ts` file and add the `inlineSvg` function to your plugins list.

```javascript
import { Config } from '@stencil/core';
import { inlineSvg } from 'stencil-inline-svg';

export const config: Config = {
  namespace: 'mycomponent',
  outputTargets: [
    { type: 'dist' },
    { type: 'docs-readme' },
    {
      type: 'www',
      serviceWorker: null, // disable service workers
    },
  ],
  plugins: [inlineSvg()],
};
```

Now, just import your file and set it as the `innerHTML` property of an element inside your component.

```javascript
import { Component } from '@stencil/core';
import Lambo from '../../assets/img/gallardo.svg';

@Component({
  tag: 'my-component',
  styleUrl: 'my-component.css',
  shadow: true,
})
export class MyComponent {
  render() {
    return <div class='svg-container' innerHTML={Lambo} />;
  }
}
```

## Links

Stenciljs - https://stenciljs.com/

Lamborghini SVG - https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/gallardo.svg

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