Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 4defa3f

Browse files
committed
docs(nuxt): include to auto-import docs
1 parent a77f46c commit 4defa3f

File tree

4 files changed

+34
-7
lines changed

4 files changed

+34
-7
lines changed

packages/chakra-ui-core/src/directives/chakra.directive.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ export function createServerDirective (theme) {
6363
export function createClientDirective (theme) {
6464
function applyClientStyles (el, binding, vnode) {
6565
const { styleAttrs } = extractChakraAttrs(vnode.data.attrs)
66-
// console.log({ styleAttrs, nativeAttrs })
6766
const className = css(Css(styleAttrs)(theme))
6867
el.classList.add(className)
6968
purifyAttrs(el, styleAttrs)

website/components/BottomLink.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ export default {
6060
this.prevName = prev.name
6161
this.nextPath = next.path
6262
this.nextName = next.name
63-
console.log(this.prevName, this.nextName)
6463
}
6564
}
6665
</script>

website/layouts/default.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,22 @@ export default {
9393
light: {
9494
bg: 'rgb(254, 235, 200)',
9595
color: 'black',
96-
borderLeft: '4px solid rgb(221, 107, 32)'
96+
borderLeft: '4px solid rgb(221, 107, 32)',
97+
rounded: 'md'
9798
},
9899
dark: {
99100
bg: 'rgba(251, 211, 141, 0.16)',
100101
color: 'inherit',
101-
borderLeft: '4px solid rgb(251, 211, 141);'
102+
borderLeft: '4px solid rgb(251, 211, 141);',
103+
rounded: 'md'
102104
}
103105
},
104106
code: {
105107
light: {
106-
color: 'orange.600'
108+
color: 'indigo.500'
107109
},
108110
dark: {
109-
color: 'rgb(250, 195, 137)'
111+
color: 'indigo.100'
110112
}
111113
},
112114
MDXComponents

website/pages/auto-import-components.mdx

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ module.exports = {
4444
```
4545
### With `webpack.config.js`
4646
```js
47-
/* webkack.config.js */
47+
/* webpack.config.js */
4848

4949
const VueLoaderPlugin = require('vue-loader/lib/plugin')
5050
const { ChakraLoaderPlugin } = require('chakra-loader')
@@ -59,12 +59,37 @@ module.exports = {
5959
```
6060

6161
### With Nuxt.js
62+
As of `@chakra-ui/[email protected]`, you can enable and disable component auto-import using the `chakra.config.autoImport: {Boolean}` property of your `nuxt.config.js` file.
63+
64+
> This change is only supported for `@chakra-ui/nuxt@^0.1.0`. We recommend upgrading your Nuxt module version to `^0.1.0`.
65+
66+
```js
67+
/* nuxt.config.js */
68+
69+
export default {
70+
// ...
71+
chakra: {
72+
config: {
73+
/**
74+
* Setting this value to false disables
75+
* component auto-import in your Vue templates
76+
* @type {Boolean}
77+
**/
78+
autoImport: true
79+
}
80+
}
81+
}
82+
```
83+
84+
For older versions of `@chakra-ui/nuxt`, you can enable component auto importing yourself:
85+
6286
```js
6387
/* nuxt.config.js */
6488

6589
import { ChakraLoaderPlugin } from 'chakra-loader'
6690

6791
export default {
92+
// ...
6893
build: {
6994
extend(config) {
7095
config.plugins.push(
@@ -75,6 +100,8 @@ export default {
75100
}
76101
```
77102

103+
104+
78105
## How it works
79106
`ChakraLoaderPlugin` will analyse your SFC template at during development and at build time, and scan it for all Chakra UI Vue components that you consume in it. The loader will then proceed to automatically import those components and register them while preserving treeshaking.
80107

0 commit comments

Comments
 (0)