Skip to content

Commit 6fb0cbc

Browse files
committed
Initial commit
0 parents  commit 6fb0cbc

File tree

5 files changed

+93
-0
lines changed

5 files changed

+93
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/node_modules
2+
npm-debug.log
3+
package-lock.json

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Andrei Ioniță
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# vue-svg-component-loader
2+
Zero-dependency webpack loader that turns SVG files into Vue components. This loader doesn't do anything else.
3+
4+
## Installation
5+
6+
```sh
7+
npm install vue-svg-component-loader --save-dev
8+
```
9+
## Configuration
10+
11+
```js
12+
module.exports = {
13+
module: {
14+
rules: [
15+
{
16+
test: /\.svg$/,
17+
use: [
18+
'raw-loader', // not included, install separately
19+
'svgo-loader', // not included, install separately
20+
'vue-svg-component-loader',
21+
],
22+
},
23+
],
24+
},
25+
};
26+
```
27+
28+
## Usage
29+
30+
```vue
31+
<template>
32+
<div>
33+
<AppLogo />
34+
</div>
35+
</template>
36+
37+
<script>
38+
import AppLogo from 'path/to/logo.svg';
39+
40+
export default {
41+
components: {
42+
AppLogo,
43+
},
44+
};
45+
</script>
46+
```

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = (svg) => `<template>${svg}</template>`;

package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "vue-svg-component-loader",
3+
"version": "0.0.0",
4+
"description": "zero-dependency webpack loader that turns SVG files into Vue components",
5+
"main": "index.js",
6+
"repository": {
7+
"type": "git",
8+
"url": "git+https://github.com/andreiio/vue-svg-component-loader.git"
9+
},
10+
"keywords": [
11+
"webpack",
12+
"svg",
13+
"vue",
14+
"loader"
15+
],
16+
"author": "Andrei Ioniță",
17+
"license": "MIT",
18+
"bugs": {
19+
"url": "https://github.com/andreiio/vue-svg-component-loader/issues"
20+
},
21+
"homepage": "https://github.com/andreiio/vue-svg-component-loader#readme"
22+
}

0 commit comments

Comments
 (0)