Skip to content

Commit 28612a5

Browse files
authored
feat(website): show draft content on preview deployments (#708)
We also use SSR so that we don't have to rebuild when the CMS changes.
1 parent 849bee7 commit 28612a5

4 files changed

Lines changed: 159 additions & 1 deletion

File tree

astro.config.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1+
import node from '@astrojs/node';
12
import svelte from '@astrojs/svelte';
23
import tailwindcss from '@tailwindcss/vite';
34
import { defineConfig } from 'astro/config';
45

6+
const PREVIEW = process.env.PREVIEW_DEPLOYMENT === 'true';
7+
8+
// for a live preview we need server side rendering
9+
const adapter = PREVIEW
10+
? node({
11+
mode: 'standalone',
12+
})
13+
: undefined;
14+
515
// https://astro.build/config
616
export default defineConfig({
17+
adapter,
718
image: {
819
remotePatterns: [
920
{
@@ -18,6 +29,7 @@ export default defineConfig({
1829
},
1930

2031
integrations: [svelte()],
32+
output: PREVIEW ? 'server' : 'static',
2133
server: ({ command }) => ({ port: command === 'dev' ? 5173 : 4321 }),
2234
trailingSlash: 'never',
2335

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
},
2525
"dependencies": {
2626
"@astrojs/check": "0.9.4",
27+
"@astrojs/node": "9.2.0",
2728
"@astrojs/svelte": "7.0.10",
2829
"@astrojs/tailwind": "6.0.2",
2930
"@melt-ui/svelte": "0.86.6",

pnpm-lock.yaml

Lines changed: 138 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)