Comparing version 1.0.2 to 1.0.3
@@ -57,5 +57,3 @@ "use strict"; | ||
const sprite = document.createElementNS(SVG_NAMESPACE, 'svg'); | ||
const defs = document.createElementNS(SVG_NAMESPACE, 'defs'); | ||
this.symbolsMountingPoint = defs; | ||
sprite.appendChild(defs); | ||
this.symbolsMountingPoint = sprite; | ||
sprite.ariaHidden = 'true'; | ||
@@ -62,0 +60,0 @@ sprite.style.width = '0'; |
{ | ||
"name": "handy-svg", | ||
"version": "1.0.2", | ||
"description": "A tool for loading svgs to the sprite on the fly", | ||
"version": "1.0.3", | ||
"description": "The most handy way to use <svg> on the web", | ||
"main": "src/index.tsx", | ||
@@ -11,3 +11,2 @@ "scripts": { | ||
"release": "npm run lint && npm version patch && npm run build && npm run pub", | ||
"cp": "npm run build && mkdir -p ../geoadv/node_modules/handy-svg && cp -r ./dist/ ../geoadv/node_modules/handy-svg/", | ||
"postinstall": "husky install" | ||
@@ -14,0 +13,0 @@ }, |
<img width="200" alt="handy_svg" src="https://user-images.githubusercontent.com/2974415/162402689-e1382bba-9fe1-4bf8-8d45-bc28a78ab5c7.png"> | ||
External svg-icons that you can style with css. | ||
The most handy way to use `<svg>` on the web. | ||
 | ||
## How it works | ||
@@ -14,3 +16,3 @@ 1. Fetches your svgs in browser with `fetch` request. And caches of course. | ||
2. Styling with css is a must-have, and this is the only way of getting it except for inlining. | ||
3. Inlining svgs with React midth be painful, it also increases the bundle size and just doesn't feel right. But there is a [tool](https://react-svgr.com/) if you wish. | ||
3. Inlining svgs with React might be painful (there is a [tool](https://react-svgr.com/) though), it also increases the bundle size and just doesn't feel right. | ||
@@ -36,3 +38,3 @@ ## Usage | ||
/> | ||
) | ||
); | ||
``` | ||
@@ -57,6 +59,7 @@ | ||
But in fact there is no difference for the handy-svg where you get your svgs urls from. | ||
You may also use it without React at all. | ||
But in fact there is no difference for the **handy-svg** where you get your svgs urls from. | ||
#### Standalone | ||
You may also use **handy-svg** without React at all. | ||
``` typescript | ||
@@ -108,3 +111,10 @@ import {injector} from 'handy-svg/lib/injector'; | ||
import {injector} from 'handy-svg/lib/injector'; | ||
injector.getId(src): string; | ||
injector.getId(src: string): string; | ||
``` | ||
## CSP | ||
You should add hostnames of your icons to the [connect-src](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/connect-src) directive of your [Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) header for this to work properly. | ||
## License | ||
[MIT](https://github.com/ivliag/handy-svg/blob/master/LICENSE) |
15138
117
260