@harlem/plugin-ssr
The official server-side rendering plugin for Harlem
14,341
515
| Install | |
|---|---|
npm install @harlem/plugin-ssr |
|
| Latest Version: | 3.1.8 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Jun 3, 2024 |
| Links: | GitHub · npm |
Maintainer: andrewcourtice
Harlem Server-Side Rendering Plugin
The SSR plugin adds support for using Harlem in a Vue server-side rendered application.
Installation
Before installing the ssr plugin make sure you have installed harlem.
yarn add @harlem/plugin-ssr
# or
npm install @harlem/plugin-ssr
Usage
Server
Create an instance of the plugin and register it with Harlem on the server:
import App from './app.vue';
import {
createVuePlugin
} from 'harlem';
import {
createServerSSRPlugin
} from '@harlem/plugin-ssr';
createSSRApp(App)
.use(createVuePlugin({
plugins: [
createServerSSRPlugin()
]
}));
Generate the bridging script block and insert it into the server-rendered content:
import {
renderToString
} from '@vue/server-renderer';
import {
getBridgingScriptBlock
} from '@harlem/plugin-ssr';
let output = await renderToString(app);
output += getBridgingScriptBlock();
Client
Create an instance of the plugin and register it with Harlem on the client:
import App from './app.vue';
import {
createVuePlugin
} from 'harlem';
import {
createClientSSRPlugin
} from '@harlem/plugin-ssr';
createApp(App)
.use(createVuePlugin({
plugins: [
createClientSSRPlugin()
]
}));
Types that are not support by JSON serialisation will not be transferred from server to client. See the MDN documentation on JSON serialisation for more information: MDN docs
Related Packages
vue-ssr-webpack-plugin
webpack plugin for generating a bundle manifest to use with Vue 2.x bundleRender...
100,967
Version History
| Version | Released | License |
|---|---|---|
| 3.1.8 | MIT | |
| 3.1.7 | MIT | |
| 3.1.6 | MIT | |
| 3.1.5 | MIT | |
| 3.1.4 | MIT | |
| 3.1.3 | MIT | |
| 3.1.2 | MIT | |
| 3.1.1 | MIT | |
| 3.1.0 | MIT | |
| 3.0.2 | MIT | |
| 3.0.1 | MIT | |
| 3.0.0 | MIT | |
| 2.3.9 | MIT | |
| 2.3.8 | MIT | |
| 2.3.7 | MIT | |
| 2.3.6 | MIT | |
| 2.3.5 | MIT | |
| 2.3.3 | MIT | |
| 2.3.2 | MIT | |
| 2.3.1 | MIT | |
| 2.3.0 | MIT | |
| 2.2.3 | MIT | |
| 2.2.2 | MIT | |
| 2.2.1 | MIT | |
| 2.2.0 | MIT | |
| 2.1.1 | MIT | |
| 2.1.0 | MIT | |
| 2.0.1 | MIT | |
| 2.0.0 | MIT | |
| 1.3.2 | MIT |
Showing the latest 30 of 47. See every release on npm
Pre-releases (25)
| Version | Released | License |
|---|---|---|
| 3.0.0-beta.1 | MIT | |
| 3.0.0-beta.0 | MIT | |
| 2.4.0-beta.11 | MIT | |
| 2.4.0-beta.10 | MIT | |
| 2.4.0-beta.9 | MIT | |
| 2.4.0-beta.8 | MIT | |
| 2.4.0-beta.7 | MIT | |
| 2.4.0-beta.6 | MIT | |
| 2.4.0-beta.5 | MIT | |
| 2.4.0-beta.4 | MIT | |
| 2.4.0-beta.3 | MIT | |
| 2.4.0-beta.2 | MIT | |
| 2.4.0-beta.1 | MIT | |
| 2.0.0-beta.10 | MIT | |
| 2.0.0-beta.9 | MIT | |
| 2.0.0-beta.8 | MIT | |
| 2.0.0-beta.7 | MIT | |
| 2.0.0-beta.6 | MIT | |
| 2.0.0-beta.5 | MIT | |
| 2.0.0-beta.4 | MIT | |
| 2.0.0-beta.3 | MIT | |
| 2.0.0-beta.2 | MIT | |
| 2.0.0-beta.1 | MIT | |
| 2.0.0-beta.0 | MIT | |
| 2.0.0-alpha.0 | MIT |