|
| 1 | +# vue-undraw |
| 2 | +Vue Illustration Components from https://undraw.co/ |
| 3 | +For any requests open an issue on https://github.com/netzfluencer/vue-undraw/issues |
| 4 | + |
| 5 | +## Installation |
| 6 | +`npm install vue-undraw` |
| 7 | + |
| 8 | +## Setup |
| 9 | +You can use the vue-undraw in multiple approaches. Keep in mind that the total size of all illustrations goes beyond 20mb. A global usage in vue projects is technical possible, but not generaly not recommended. |
| 10 | + |
| 11 | +### 1. Register a component by referencing to the specific Source |
| 12 | +This is the most simplest approach to keep depended projects as small as possible, by importing only the illustrations which are needed. |
| 13 | +``` |
| 14 | +import UndrawAddColor from 'vue-undraw/src/components/UndrawAddColor' |
| 15 | +
|
| 16 | +export default { |
| 17 | + components: { |
| 18 | + UndrawAddColor |
| 19 | + } |
| 20 | +} |
| 21 | +``` |
| 22 | + |
| 23 | +### 2. Register a component-module from '@netzfluencer/vue-undraw' |
| 24 | +Similar to first approach. Benefits compared to first: |
| 25 | +1. shorter and clearer imports |
| 26 | +2. consistent illustrationnames |
| 27 | + |
| 28 | +Feel free to take this approach if treeshaking is no problem. https://webpack.js.org/guides/tree-shaking/ |
| 29 | +``` |
| 30 | +import { UndrawAbstract, UndrawAddColor } from '@netzfluencer/vue-undraw' |
| 31 | +
|
| 32 | +export default { |
| 33 | + components: { |
| 34 | + UndrawAbstract |
| 35 | + UndrawAddColor |
| 36 | + } |
| 37 | +} |
| 38 | +``` |
| 39 | + |
| 40 | +### 3. Global installation |
| 41 | +If project size does not need to be considered as much (e.g. in a design systems documentation env.) it is also possible to use the illustrations globally. |
| 42 | + |
| 43 | +Just add this in your entrypoints js-file: |
| 44 | +``` |
| 45 | +import * as VueUndraw from 'vue-undraw' |
| 46 | +
|
| 47 | +Vue.use(VueUndraw) |
| 48 | +``` |
| 49 | + |
| 50 | +## Color Setup |
| 51 | +By default the svgs colors are inherting the svgs/parents text-color. You can overwrite this colors by using the `vue-undraw` css-class or by setting it up in the installations options. (If you don't want to install the components globally you need to add the `noGlobalInstall: true` key too) |
| 52 | +``` |
| 53 | +import * as VueUndraw from 'vue-undraw' |
| 54 | +
|
| 55 | +Vue.use(VueUndraw, {color: '#777777', noGlobalInstall: true}) |
| 56 | +``` |
| 57 | + |
| 58 | +----------- |
| 59 | + |
| 60 | +## Project Development |
| 61 | +``` |
| 62 | +npm install |
| 63 | +``` |
| 64 | + |
| 65 | +### Renaming svgs |
| 66 | +Rename saved svgs from undraw.co in the _illustrations dir. Some manual adjustments need to get done (e.g. removing a handfull of '-'). |
| 67 | +``` |
| 68 | +npm run rename |
| 69 | +``` |
| 70 | + |
| 71 | +### Component Creation |
| 72 | +Create vue components from svgs. Some manual adjustments need to get done (e.g. syntax errors in components/index.js) |
| 73 | +``` |
| 74 | +npm run create |
| 75 | +``` |
| 76 | + |
| 77 | +### Compiles and minifies for production |
| 78 | +``` |
| 79 | +npm run build |
| 80 | +``` |
0 commit comments