https://github.com/pumpncode/fresh-plugin-svg-inject
This is a plugin for fresh that injects SVGs referenced in img tags into the rendered html text.
https://github.com/pumpncode/fresh-plugin-svg-inject
deno fresh fresh-plugin
Last synced: 4 months ago
JSON representation
This is a plugin for fresh that injects SVGs referenced in img tags into the rendered html text.
- Host: GitHub
- URL: https://github.com/pumpncode/fresh-plugin-svg-inject
- Owner: pumpncode
- License: mit
- Created: 2024-01-07T16:26:44.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-11-15T21:32:26.000Z (7 months ago)
- Last Synced: 2026-01-15T04:26:41.648Z (5 months ago)
- Topics: deno, fresh, fresh-plugin
- Language: JavaScript
- Homepage: https://deno.land/x/fresh_plugin_svg_inject
- Size: 225 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- Contributing: contributing.md
- License: license.md
Awesome Lists containing this project
README
# fresh-plugin-svg-inject
This is a plugin for [fresh](https://github.com/denoland/fresh) that injects SVGs referenced in `img` tags into the rendered html text.
It turns this:
```html
```
```html
```
into this:
```html
```
before your site gets served.
The ids are renamed to avoid collisions. This plugin is in essence a modern, less sophisticated port of [iconfu/svg-inject](https://github.com/iconfu/svg-inject) for fresh.
## Usage
```js
import tailwind from "$fresh/plugins/tailwind.ts";
import svgInjectPlugin from "https://deno.land/x/fresh_plugin_svg_inject/main.js";
import { defineConfig } from "$fresh/server.ts";
export default defineConfig({
plugins: [
tailwind(),
svgInjectPlugin()
]
});
```
You can also pass an options object to `svgInjectPlugin()` with a single `staticFolder` option, which should be the same as the `staticDir` option specified on the fresh config. Default is `"./static"` and I know this should be read automatically but I have no idea how; contributions are welcome.
## Contributing
We appreciate your help! To contribute, please read our [contributing instructions](./contributing.md).