Skip to content

Commit 2728cd8

Browse files
committed
initial commit
0 parents  commit 2728cd8

File tree

6 files changed

+11524
-0
lines changed

6 files changed

+11524
-0
lines changed

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.DS_Store
2+
node_modules
3+
/dist
4+
5+
# local env files
6+
.env.local
7+
.env.*.local
8+
9+
# Log files
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
14+
# Editor directories and files
15+
.idea
16+
.vscode
17+
*.suo
18+
*.ntvs*
19+
*.njsproj
20+
*.sln
21+
*.sw?

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# vue-extensions
2+
3+
This library is a Vue.js plugin which creates a component which acts as extension point, with a named "hook". Plugins can then provide plugin components for this extension point which are automatically found and rendered replacing the extension.
4+
5+
## Usage
6+
```javascript
7+
// main.js
8+
import Extensions from 'vue-extensions'
9+
import foo from './plugins/foo'
10+
11+
Vue.use(Extensions, {plugins: {foo}})
12+
13+
new Vue({
14+
// ...
15+
})
16+
```
17+
18+
This is all you need for having now an `<extension>` tag available anywhere:
19+
20+
```html
21+
<template>
22+
<ul>
23+
<extension hook="my-list-element">
24+
</ul>
25+
</template>
26+
```
27+
28+
Now, in plugins/foo.js:
29+
30+
```
31+
import FooListElement from './components/list_element'
32+
33+
export default {
34+
hooks: {
35+
"my-list-element": FooListElement
36+
"blah-another-hook": [FooElement, BazElement]
37+
}
38+
}
39+
```
40+
41+
vue-extensions finds this file and renders the two elements instead of the <extension> element. You have to make sure that your components do what they promise: in this case, FooListElement should render a <li> element containing some things.
42+
43+
### Project setup
44+
```
45+
npm install
46+
```
47+
48+
#### Compiles and hot-reloads for development
49+
```
50+
npm run serve
51+
```
52+
53+
#### Compiles and minifies library for production
54+
```
55+
npm run build-lib
56+
```
57+
58+
#### Run your tests
59+
```
60+
npm run test
61+
```
62+
63+
#### Lints and fixes files
64+
```
65+
npm run lint
66+
```
67+
68+
#### Customize configuration
69+
See [Configuration Reference](https://cli.vuejs.org/config/).

babel.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/cli-plugin-babel/preset'
4+
]
5+
}

0 commit comments

Comments
 (0)