Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
gkatsanos committed May 23, 2023
2 parents 351de45 + 1184afa commit e936a5c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 37 deletions.
3 changes: 0 additions & 3 deletions .github/FUNDING.yml

This file was deleted.

17 changes: 5 additions & 12 deletions README.md
@@ -1,3 +1,5 @@
*This is a fork of https://github.com/jpkleemans/vite-svg-loader with the sole difference that it replaces `component` with `inline` to make it backwards compatible with components using the webpack svg loader.*

# Vite SVG loader
Vite plugin to load SVG files as Vue components, using SVGO for optimization.

Expand Down Expand Up @@ -48,9 +50,9 @@ import iconRaw from './my-icon.svg?raw'
```

### Component
SVGs can be explicitly imported as Vue components using the `?component` suffix:
SVGs can be explicitly imported as Vue components using the `?inline` suffix:
```js
import IconComponent from './my-icon.svg?component'
import IconComponent from './my-icon.svg?inline'
// <IconComponent />
```

Expand Down Expand Up @@ -92,18 +94,9 @@ import IconWithoutOptimizer from './my-icon.svg?skipsvgo'
```

### Use with TypeScript
If you use the loader in a Typescript project, you'll need to import your svg files with the `?component` param: `import MyIcon from './my-icon.svg?component'`.
If you use the loader in a Typescript project, you'll need to import your svg files with the `?inline` param: `import MyIcon from './my-icon.svg?inline'`.

You'll also need to reference the type definitions:
```ts
/// <reference types="vite-svg-loader" />
```

## Sponsors

<a href="https://www.nexxtmove.nl/" target="_blank">
<img src="https://raw.githubusercontent.com/jpkleemans/attribute-events/gh-pages/nexxtmove-logo.svg" alt="Nexxtmove Logo" width="200">
</a>

Thanks to <a href="https://www.nexxtmove.nl/" target="_blank">Nexxtmove</a> for sponsoring the development of this project.
Your logo or name here? [Sponsor this project](https://github.com/sponsors/jpkleemans).
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -5,7 +5,7 @@ const { optimize: optimizeSvg } = require('svgo')
module.exports = function svgLoader (options = {}) {
const { svgoConfig, svgo, defaultImport } = options

const svgRegex = /\.svg(\?(raw|component|skipsvgo))?$/
const svgRegex = /\.svg(\?(raw|inline|skipsvgo))?$/

return {
name: 'svg-loader',
Expand Down
34 changes: 13 additions & 21 deletions package.json
@@ -1,14 +1,18 @@
{
"name": "vite-svg-loader",
"version": "4.1.0",
"description": "Vite plugin to load SVG files as Vue components",
"keywords": [
"vite",
"vue",
"svg"
],
"name": "@gkatsanos/vite-svg-loader",
"version": "1.3.0",
"description": "A Vite loader to manage SVG files",
"main": "./index.js",
"types": "./index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/gkatsanos/vite-svg-loader.git"
},
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/gkatsanos/vite-svg-loader/issues"
},
"dependencies": {
"svgo": "^3.0.2"
},
Expand All @@ -25,17 +29,5 @@
"example:build": "cd ./examples/vue && npm ci && npm run build",
"example:serve": "cd ./examples/vue && npm run serve"
},
"repository": {
"type": "git",
"url": "git+https://github.com/jpkleemans/vite-svg-loader.git"
},
"author": {
"name": "Jan-Paul Kleemans",
"email": "jpkleemans@gmail.com"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/jpkleemans/vite-svg-loader/issues"
},
"homepage": "https://github.com/jpkleemans/vite-svg-loader#readme"
"homepage": "https://github.com/gkatsanos/vite-svg-loader#readme"
}

0 comments on commit e936a5c

Please sign in to comment.