Skip to content

Commit 762fa34

Browse files
committed
Updated documentation
1 parent 31a12c4 commit 762fa34

File tree

2 files changed

+25
-28
lines changed

2 files changed

+25
-28
lines changed

docs/src/content/docs/start-here/getting-started.mdx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,20 @@ bun add -D svelte-reveal
6363
</script>
6464
```
6565

66-
2. Add the imported `reveal` action to the DOM element you want to transition:
66+
2. Add the custom preprocessor to your `svelte.config.js`
67+
68+
```js
69+
// svelte.config.js
70+
import { svelteRevealPreprocess } from 'svelte-reveal';
71+
72+
const config = {
73+
...
74+
preprocess: [..., svelteRevealPreprocess()],
75+
...
76+
};
77+
```
78+
79+
3. Add the imported `reveal` action to the DOM element you want to transition:
6780

6881
```svelte
6982
// App.svelte

docs/src/content/docs/start-here/sveltekit.mdx

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar:
66

77
import { Steps, Aside } from '@astrojs/starlight/components';
88

9-
<Aside type="caution" title="Last update: April 2024">
9+
<Aside type="caution" title="Last update: August 2024">
1010
This is an active area of research. Please [submit a bug
1111
report](https://github.com/DaveKeehl/svelte-reveal/issues/new) in case of issues.
1212
</Aside>
@@ -24,31 +24,15 @@ export const ssr = false;
2424

2525
## With SSR
2626

27-
If your page does need to leverage server-side rendering, the setup remains easy but it requires a few more steps.
27+
If your page does need to leverage server-side rendering, you need to instruct the Svelte Reveal preprocessor to go in ssr mode as follows. Doing as such will prevent the elements to flicker as soon as the page is hydrated and the DOM is accessible to the library.
2828

29-
<Steps>
29+
```js
30+
// svelte.config.js
31+
import { svelteRevealPreprocess } from 'svelte-reveal';
3032

31-
1. Import the bundled stylesheet in your page or layout
32-
33-
```svelte
34-
<script lang="ts">
35-
// layout.svelte
36-
import "svelte-reveal/styles.css";
37-
...
38-
</script>
39-
40-
...
41-
```
42-
43-
2. Add the `sr__hide` css class to every element targeted by Svelte Reveal with `use:reveal`. This will prevent the elements to flicker as soon as the page is hydrated and the DOM is accessible to the library.
44-
45-
```svelte
46-
<script lang="ts">
47-
// page.svelte
48-
import { reveal } from 'svelte-reveal';
49-
</script>
50-
51-
<h1 use:reveal class="sr__hide">Hello world</h1>
52-
```
53-
54-
</Steps>
33+
const config = {
34+
...
35+
preprocess: [..., svelteRevealPreprocess({ ssr: true})],
36+
...
37+
};
38+
```

0 commit comments

Comments
 (0)