Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve DX & docs upon using vike-{react,vue,solid} configs with…
…out installing (fix #1578)
- Loading branch information
Showing
14 changed files
with
125 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
export { ImplementedBy } | ||
|
||
import { Link } from '@brillout/docpress' | ||
import { UiFrameworkVikeExtension, UiFrameworkVikeExtensionNames } from '../components' | ||
import React from 'react' | ||
|
||
function ImplementedBy({ | ||
children, | ||
by, | ||
noCustomGuide | ||
}: { children: React.ReactNode; by?: React.ReactNode; noCustomGuide?: true }) { | ||
return ( | ||
<> | ||
<br /> | ||
Implemented by: {by ?? <UiFrameworkVikeExtensionNames />}. | ||
<blockquote> | ||
<p> | ||
You need to use{' '} | ||
{by ?? ( | ||
<> | ||
a <UiFrameworkVikeExtension /> | ||
</> | ||
)}{' '} | ||
in order to use the {children}. | ||
{!noCustomGuide && ( | ||
<> | ||
{' '}If you don't use {by ?? <UiFrameworkVikeExtensionNames />} then see{' '} | ||
<Link href="#without-vike-extension" />. | ||
</> | ||
)} | ||
</p> | ||
</blockquote> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,53 @@ | ||
import { Link, Warning } from '@brillout/docpress' | ||
|
||
You use `extends` to install <Link href="/extensions" noBreadcrumb />. | ||
To install <Link href="/extensions">Vike extensions</Link> you use `extends`: | ||
|
||
```js | ||
// /pages/+config.js | ||
|
||
import vikeReact from 'vike-react' | ||
import vikeReact from 'vike-react/config' | ||
|
||
export default { | ||
// Inherit the configuration set by vike-react | ||
// Install vike-react. | ||
// In technical terms: inherit the configuration set by `vike-react/config`. | ||
extends: vikeReact | ||
} | ||
``` | ||
|
||
## Inheritance | ||
|
||
Note that <Link href="/config#inheritance">config inheritance</Link> also applies to `extends`. | ||
|
||
For example, you can use two completely different rendering strategy: some pages can use Vue without SSR while other pages can use React with SSR. | ||
|
||
```js | ||
// /pages/admin/+config.js | ||
|
||
import vikeVue from 'vike-vue/config' | ||
|
||
// Applies only to Admin Panel pages: | ||
// /pages/admin/income/+Page.js | ||
// /pages/admin/kpi/+Page.js | ||
// ... | ||
|
||
// Make all Admin Panel pages use Vue without SSR: | ||
export default { | ||
ssr: false, | ||
extends: [vikeVue] | ||
} | ||
``` | ||
|
||
```js | ||
// /pages/product/@id/+config.js | ||
|
||
import vikeReact from 'vike-react/config' | ||
|
||
// Applies only to the product page: | ||
// /pages/product/@id/+Page.js | ||
|
||
// Make the product page use React with SSR: | ||
export default { | ||
ssr: true, | ||
extends: [vikeReact] | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters