Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit 7c64fa2

Browse files
committed
Update Docs for Nuxt
1 parent 3cca974 commit 7c64fa2

File tree

4 files changed

+50
-14
lines changed

4 files changed

+50
-14
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ postcss.config.js
1010
.prettierrc
1111
.git
1212
**/.git/
13+
**/node_modules/
1314
yarn.lock
1415
/dev
1516
/docs

dev/nuxt/nuxt.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default {
5252
*/
5353
modules: [['@asigloo/vue-dynamic-forms/nuxt']],
5454
dynamicForms: {
55-
theme: 'materialize',
55+
theme: 'default',
5656
},
5757
/*
5858
** Build configuration

docs/guide/install.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,39 @@ export {
3636
...
3737
}
3838
```
39+
40+
### Install it as Nuxt.js Module
41+
42+
Vue Dynamic Forms provides a [Nuxt.js](https://nuxtjs.org/) module for easily importing the library into your Nuxt.js App.
43+
44+
Nuxt.js version `2.12.2` (or greater) is recommended.
45+
46+
#### Getting dependencies
47+
48+
```bash
49+
yarn add @asigloo/vue-dynamic-forms
50+
51+
# or, using NPM
52+
npm install @asigloo/vue-dynamic-forms
53+
```
54+
55+
Add `@asigloo/vue-dynamic-forms/nuxt` to modules section of your `nuxt.config.js` file.
56+
57+
```javascript
58+
module.exports = {
59+
modules: ['@asigloo/vue-dynamic-forms/nuxt'],
60+
};
61+
```
62+
63+
#### Choosing theme
64+
65+
You can select directly the theme trough `dynamicForms` options like this
66+
67+
```javascript
68+
module.exports = {
69+
modules: ['@asigloo/vue-dynamic-forms/nuxt'],
70+
dynamicForms: {
71+
theme: 'materialize',
72+
},
73+
};
74+
```

nuxt/index.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@ const THEMES = ['default'];
55
module.exports = function nuxtDynamicForms(moduleOptions) {
66
const options = Object.assign({}, this.options.dynamicForms, moduleOptions);
77

8-
if (THEMES.includes(options.theme)) {
9-
this.options.css.push(
10-
`@asigloo/vue-dynamic-forms/src/styles/themes/${options.theme}.scss`,
11-
);
12-
} else {
13-
this.options.css.push(
14-
`@asigloo/vue-dynamic-forms/src/styles/themes/default.scss`,
15-
);
16-
console.warn(
17-
`[vue-dynamic-forms warn]: Theme '${options.theme}' does not exit yet. \n` +
18-
`Selecting theme 'default'. \n` +
19-
`You can propose it as a new theme by creating a PR here 'https://github.com/alvarosaburido/vue-dynamic-forms/pulls'`,
20-
);
8+
if (options && options.theme !== undefined) {
9+
if (THEMES.includes(options.theme)) {
10+
this.options.css.push(
11+
`@asigloo/vue-dynamic-forms/src/styles/themes/${options.theme}.scss`,
12+
);
13+
} else {
14+
console.warn(
15+
`[vue-dynamic-forms warn]: Theme '${options.theme}' does not exit yet. \n` +
16+
`Selecting theme 'default'. \n` +
17+
`You can propose it as a new theme by creating a PR here 'https://github.com/alvarosaburido/vue-dynamic-forms/pulls'`,
18+
);
19+
}
2120
}
2221
// Register plugin
2322
this.addPlugin({

0 commit comments

Comments
 (0)