Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update webpack config for vue-book dev server. * Added SSR guide page.
- Loading branch information
Showing
10 changed files
with
135 additions
and
4 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
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
3 changes: 3 additions & 0 deletions
3
packages/docs/src/page-configs/getting-started/ssr-guide/code-examples/css-variables.ts
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,3 @@ | ||
export default ` | ||
app.config.globalProperties.$vaColorConfig.renderCSSVarialbes() | ||
` |
3 changes: 3 additions & 0 deletions
3
packages/docs/src/page-configs/getting-started/ssr-guide/code-examples/index.ts
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,3 @@ | ||
export { default as cssVariables } from './css-variables' | ||
export { default as viteSsrPlugin } from './vite-ssr-plugin' | ||
export { default as vitesse } from './vitesse' |
22 changes: 22 additions & 0 deletions
22
packages/docs/src/page-configs/getting-started/ssr-guide/code-examples/vite-ssr-plugin.ts
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,22 @@ | ||
export default `// ... | ||
import { createVuestic } from 'vuestic-ui' | ||
import 'vuestic-ui/css' | ||
export async function render(pageContext) { | ||
// ... | ||
app.use(createVuestic()) | ||
const appHtml = await renderToString(app) | ||
const cssVarialbes = app.config.globalProperties.$vaColorConfig.renderCSSVarialbes() | ||
return escapeInject\`<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Vuestic App</title> | ||
<style>\${cssVarialbes}</style> | ||
</head> | ||
<body> | ||
<div id="app">\${dangerouslySkipEscape(appHtml)}</div> | ||
</body> | ||
</html>\` | ||
}` |
24 changes: 24 additions & 0 deletions
24
packages/docs/src/page-configs/getting-started/ssr-guide/code-examples/vitesse.ts
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,24 @@ | ||
export default `// ... | ||
import { createVuestic } from 'vuestic-ui' | ||
import { ref } from 'vue' | ||
import 'vuestic-ui/css' | ||
const routes = setupLayouts(generatedRoutes) | ||
export const createApp = ViteSSG( | ||
App, | ||
{ routes, base: import.meta.env.BASE_URL }, | ||
(ctx) => { | ||
Object.values(import.meta.globEager('./modules/*.ts')).forEach(i => i.install?.(ctx)) | ||
ctx.app.use(createVuestic()) | ||
const head = app.config.globalProperties.$head | ||
const colorConfig = app.config.globalProperties.$vaColorConfig | ||
head.addHeadObjs(ref({ | ||
htmlAttrs: { | ||
style: colorConfig.renderCSSVarialbes(), | ||
}, | ||
})) | ||
}, | ||
) | ||
` |
28 changes: 28 additions & 0 deletions
28
packages/docs/src/page-configs/getting-started/ssr-guide/page-config.ts
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,28 @@ | ||
import { ApiDocsBlock } from '@/types/configTypes' | ||
import { PageGenerationHelper } from '@/helpers/DocsHelper' | ||
import * as code from './code-examples' | ||
|
||
const block = new PageGenerationHelper(__dirname) | ||
|
||
const config: ApiDocsBlock[] = [ | ||
block.title('ssrGuide.title'), | ||
block.paragraph('ssrGuide.description'), | ||
|
||
block.subtitle('ssrGuide.cssVariables.title'), | ||
block.paragraph('ssrGuide.cssVariables.description'), | ||
block.code(code.cssVariables), | ||
|
||
block.subtitle('ssrGuide.solutions.title'), | ||
block.paragraph('ssrGuide.solutions.description'), | ||
|
||
block.link('ssrGuide.solutions.nuxt', '/en/getting-started/nuxt'), | ||
|
||
block.headline('ssrGuide.solutions.viteSsrPlugin.title'), | ||
block.paragraph('ssrGuide.solutions.viteSsrPlugin.description'), | ||
block.code(code.viteSsrPlugin), | ||
block.headline('ssrGuide.solutions.vitesse.title'), | ||
block.paragraph('ssrGuide.solutions.vitesse.description'), | ||
block.code(code.vitesse), | ||
] | ||
|
||
export default config |
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 |
---|---|---|
|
@@ -9,4 +9,4 @@ export default defineManualApi({ | |
types: '`(files: VaFile[]) => void`', | ||
}, | ||
}, | ||
}) | ||
}) |
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,20 @@ | ||
<template> | ||
<docs-content :config="configComputed" /> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Vue, Options } from 'vue-class-component' | ||
import DocsContent from '../../components/DocsContent.vue' | ||
import ssrGuideConfig from '../../page-configs/getting-started/ssr-guide/page-config' | ||
@Options({ | ||
components: { | ||
DocsContent, | ||
}, | ||
}) | ||
export default class SsrGuide extends Vue { | ||
get configComputed () { | ||
return ssrGuideConfig | ||
} | ||
} | ||
</script> |