Skip to content

Commit

Permalink
Merge pull request #77 from MammutAlex/patch-1
Browse files Browse the repository at this point in the history
Correct readme
  • Loading branch information
freekmurze authored Apr 10, 2021
2 parents a07478e + cbaab4c commit 5f75f86
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ Besides the above, no configuration's required. If you need to tweak things anyw
You'll need to build two scripts: a server script and a client script. Refer to your frontend-framework-of-choice's documentation on how to build those.

```js
mix.js('resources/assets/js/app-client.js', 'public/js')
.js('resources/assets/js/app-server.js', 'public/js');
mix.js('resources/js/app-client.js', 'public/js')
.js('resources/js/app-server.js', 'public/js');
```

The server script should be passed to the `ssr` function, the client script should be loaded manually. The package assumes you're using Laravel Mix, and will resolve the path for you. You can opt out of this behaviour by setting `mix` to `false` in the config file.
Expand All @@ -85,7 +85,7 @@ The server script should be passed to the `ssr` function, the client script shou
Your server script should call a `dispatch` function to send the rendered html back to the view. Here's a quick example of a set of Vue scripts for a server-rendered app. Read the [spatie/server-side-rendering](https://github.com/spatie/server-side-rendering#core-concepts) readme for a full explanation of how everything's tied together.

```js
// resources/assets/js/app.js
// resources/js/app.js

import Vue from 'vue';
import App from './components/App';
Expand All @@ -96,15 +96,15 @@ export default new Vue({
```

```js
// resources/assets/js/app-client.js
// resources/js/app-client.js

import app from './app';

app.$mount('#app');
```

```js
// resources/assets/js/app-server.js
// resources/js/app-server.js

import app from './app';
import renderVueComponentToString from 'vue-server-renderer/basic';
Expand All @@ -126,7 +126,7 @@ The package exposes an `ssr` helper to render your app.
<html>
<head>
<title>My server side rendered app</title>
<script defer src="{{ mix('app-client.js') }}">
<script defer src="{{ mix('js/app-client.js') }}"></script>
</head>
<body>
{!! ssr('js/app-server.js')->render() !!}
Expand All @@ -140,7 +140,7 @@ A facade is available too.
<html>
<head>
<title>My server side rendered app</title>
<script defer src="{{ mix('app-client.js') }}">
<script defer src="{{ mix('js/app-client.js') }}"></script>
</head>
<body>
{!! Ssr::entry('js/app-server.js')->render() !!}
Expand All @@ -154,7 +154,7 @@ Rendering options can be chained after the function or facade call.
<html>
<head>
<title>My server side rendered app</title>
<script defer src="{{ mix('app-client.js') }}">
<script defer src="{{ mix('js/app-client.js') }}"></script>
</head>
<body>
{!! ssr('js/app-server.js')->context('user', $user)->render() !!}
Expand Down

0 comments on commit 5f75f86

Please sign in to comment.