You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Uses [vuetify-loader](https://github.com/vuetifyjs/vuetify-loader) to enable automatic [tree-shaking](https://vuetifyjs.com/en/customization/a-la-carte).
130
-
Enabled only for production by default.
128
+
Location of the Vuetify options that will be passed to Vuetify.
131
129
132
-
## Vuetify Options
130
+
This file will be compiled by **webpack**, which means you'll benefit fast hot reload when changing these options, but also be able to use TypeScript without being forced to use TypeScript runtime.
133
131
134
-
Except the prior `customVariables`, `defaultAssets` and `treeShaking` options, all other options will be passed to Vuetify.
132
+
```js
133
+
// nuxt.config.js
134
+
exportdefault {
135
+
vuetify: {
136
+
optionsPath:'./vuetify.options.js'
137
+
}
138
+
}
139
+
```
135
140
141
+
> Note that you can also use [Directory Aliases](https://nuxtjs.org/guide/directory-structure#aliases) like `'~/path/to/option.js'`
In development mode, passing Vuetify options through module options in your configuration file means Nuxt will have to do a full rebuild of your application when changing them. That being said, it may not be ideal if you're tweaking a lot these options to find the ones that fits best for you.
162
+
> Notice that passing the Vuetify options directly to Module options is still supported, but it will trigger Nuxt entire rebuild if options are changed.
160
163
161
-
That's why we implemented a feature that will in a close future (Nuxt 2.9) used by more modules, that consist of being able to customize options through an external file compiled by Webpack instead of runtime.
164
+
If you need to access Nuxt context within the options file, you need to export a function instead :
162
165
163
-
In the case of this module, the options need to sit in `~/app/vuetify/options.js`
164
166
165
167
```js
166
-
// app/vuetify/options.js
167
-
exportdefault {
168
-
theme: {
169
-
dark:true
168
+
// vuetify.options.js
169
+
exportdefaultfunction ({ app }) {
170
+
return {
171
+
lang: {
172
+
t: (key, ...params) =>app.i18n.t(key, params)
173
+
}
170
174
}
171
175
}
172
176
```
173
177
174
-
The `app` folder can be customized in `nuxt.config.js` this way :
178
+
### `treeShake`
175
179
176
-
```js
177
-
// nuxt.config.js
178
-
exportdefault {
179
-
dir: {
180
-
app:'somewhere'// Nuxt will then look for 'somewhere/vuetify/options.js'
> Note that if you don't think having to change a lot Vuetify options, keeping the options in your `nuxt.config.js` is totally fine. This feature is above all present to fill the need of fast hot reload in development when changing the Vuetify options.
183
+
Uses [vuetify-loader](https://github.com/vuetifyjs/vuetify-loader) to enable automatic [tree-shaking](https://vuetifyjs.com/en/customization/a-la-carte).
0 commit comments