vuepress-plugin-global-variables
Version:
<h1 align="center">vuepress-plugin-global-variables</h1> <div align="center">
45 lines (29 loc) • 910 B
Markdown
<h1 align="center">vuepress-plugin-global-variables</h1>
<div align="center">
Plugin that add a global variables for VuePress.


</div>
```sh
yarn add -D vuepress-plugin-global-variables
```
Register plugin, all `variables` keys will be registred as a global variables in your vuepress app
```js
module.exports = {
plugins: [['vuepress-plugin-global-variables', { variables: { example: 'foo' } }]],
}
```
Now, you can simply use `$var[key]` or `this.$page.global[key]` to get your variable in any template or component.
Example:
```vue
{{ $var.example }}
// or
{{ $page.global.example }}
```
will render:
```md
foo
```