Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nuxt): add nuxt module #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ Use this method if you wish to access VueTyper globally via `window.VueTyper`.
<script src="https://unpkg.com/vue-typer/dist/vue-typer.min.js"></script>
```

## Nuxt.js

Add `vue-typer/nuxt` to modules section of `nuxt.config.js`

```js
{
modules: [
'vue-typer/nuxt'
]
}
```

## Usage
After installing VueTyper, you may choose to register it either globally or locally. [What's the difference? See the Vue documentation here.](https://vuejs.org/v2/guide/components.html#Registration)

Expand Down
11 changes: 11 additions & 0 deletions nuxt/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { resolve } = require('path')

module.exports = function nuxtVueTyper() {
this.addPlugin({
ssr: false,
src: resolve(__dirname, 'plugin.js'),
fileName: 'vue-typer.js'
})
}

module.exports.meta = require('../package.json')
4 changes: 4 additions & 0 deletions nuxt/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue'
import VueTyper from 'vue-typer'

Vue.use(VueTyper)
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "dist/vue-typer.min.js",
"files": [
"dist/vue-typer.js",
"dist/vue-typer.min.js"
"dist/vue-typer.min.js",
"nuxt"
],
"scripts": {
"dev": "NODE_ENV='development' webpack-dev-server --config build/webpack.config.dev.js --hot --inline --open --compress",
Expand Down