Skip to content

Commit 11ca16a

Browse files
committed
renamed to vue-extensionpoints
1 parent b767966 commit 11ca16a

File tree

4 files changed

+81
-61
lines changed

4 files changed

+81
-61
lines changed

README.md

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
# vue-extensions
1+
# vue-extensionpoints
22

33
This library is a Vue.js plugin providing you with an element which acts as extension point. This extension has a named "hook". Plugins then can provide components for this extension point which are automatically found and rendered replacing the extension.
44

5-
It's written in ES6. It's my first Js/Vue software, so:
5+
## Install
66

7-
1. Be patient - don't expect professional code.
8-
2. Be helpful - hints and PRs for improvements are welcome.
7+
```bash
8+
# does not work yet...
9+
# npm install vue-extensionpoints
10+
```
911

1012
## Usage
1113
```javascript
1214
// main.js
13-
import Extensions from 'vue-extensions'
14-
import foo from './plugins/foo'
15+
import Extensions from 'vue-extensionpoints'
16+
import foo from '@/plugins/foo'
1517

1618
Vue.use(Extensions, {plugins: {foo}})
1719

@@ -20,7 +22,9 @@ new Vue({
2022
})
2123
```
2224

23-
This is all you need for having now an `<extension>` tag available anywhere:
25+
You can import the `options` object from a file that can be created automatially, depending on how you have structured your plugin structures.
26+
27+
You have an `<extension>` tag available now:
2428

2529
```html
2630
<template>
@@ -32,8 +36,9 @@ This is all you need for having now an `<extension>` tag available anywhere:
3236

3337
Now, in plugins/foo.js:
3438

35-
```
39+
```javascript
3640
import FooListElement from './components/list_element'
41+
import { FooElement, BazElement } from './components/elements'
3742

3843
export default {
3944
hooks: {
@@ -43,19 +48,10 @@ export default {
4348
}
4449
```
4550

46-
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.
47-
48-
### Project setup
49-
```
50-
npm install
51-
```
51+
vue-extensionpoints finds this file and renders the hooked elements replacing the <extension> element, one after another. You have to make sure that your components do what they promise: in this case, FooListElement should render a <li> element - because it will be rendered within an <ul> element. But thee are no constraints, you are free to choose whatever you want here.
5252

53-
#### Compiles and hot-reloads for development
54-
```
55-
npm run serve
56-
```
5753

58-
#### Compiles and minifies library for production
54+
#### Compile and minifies library for production
5955
```
6056
npm run build-lib
6157
```
@@ -69,6 +65,3 @@ npm run test
6965
```
7066
npm run lint
7167
```
72-
73-
#### Customize configuration
74-
See [Configuration Reference](https://cli.vuejs.org/config/).

package-lock.json

Lines changed: 57 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{
2-
"name": "vue-extensions",
2+
"name": "vue-extensionpoints",
33
"version": "0.1.0",
44
"license": "MIT",
55
"scripts": {
66
"serve": "vue-cli-service serve",
77
"build": "vue-cli-service build",
8-
"build-lib": "vue-cli-service build --target lib --name vue-extensions src/main.js",
9-
"lint": "vue-cli-service lint"
8+
"build-lib": "vue-cli-service build --target lib --name vue-extensionpoints src/main.js",
9+
"lint": "vue-cli-service lint",
10+
"prepublish": "npm run lint && npm run build-lib"
1011
},
11-
"main": "./dist/vue-extensions.common.js",
12+
"main": "./dist/vue-extensionpoints.common.js",
1213
"dependencies": {
1314
"core-js": "^3.4.3",
1415
"vue": "^2.6.10"

src/main.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ export default {
3434
}
3535
}
3636

37-
Vue.component("extension", {
38-
name: "extension",
37+
Vue.component("extensionpoint", {
38+
name: "extensionpoint",
3939
props: {
4040
hook: String
4141
},
@@ -45,9 +45,8 @@ export default {
4545
}
4646
},
4747
template: `
48-
<div class="extension-container">
49-
<component :is="plugin_component" v-for="plugin_component in plugins">
50-
</component>
48+
<div class="extensionpoint-container">
49+
<component :is="plugin_component" v-for="plugin_component in plugins"/>
5150
</div>
5251
`
5352
})

0 commit comments

Comments
 (0)