Svelte Ssr Example screenshot

Svelte Ssr Example

Author Avatar Theme by Domingues
Updated: 27 Jun 2022
59 Stars

A Svelte 3 server side render example, with hashed JS and CSS chunks

Overview

This article is about an example of server-side rendering in Svelte 3, using hashed JavaScript and CSS chunks. It utilizes Rollup and the rollup-plugin-css-chunks. The article provides installation and usage instructions, as well as information about passing props in the URL or via a POST request. It also mentions environment variables and licenses.

Features

  • Server Side Rendering: Svelte 3 is used for server-side rendering, allowing for faster initial page load and better SEO.
  • Hashed JS and CSS Chunks: The example demonstrates the use of hashed JavaScript and CSS chunks, improving the caching and performance of the application.
  • Rollup and rollup-plugin-css-chunks: The example utilizes Rollup and the rollup-plugin-css-chunks for the build process, simplifying the setup and configuration.

Installation

To install the theme, follow these steps:

  1. Clone the repository.
  2. Open the terminal and navigate to the project directory.
  3. Install the required dependencies by running the following command:
    npm install
    
  4. Build the project by running the following command:
    npm run build
    
  5. Start the server by running the following command:
    npm run start
    
  6. Open your browser and access the application at the specified host and port.

Summary

This article provides an example of server-side rendering in Svelte 3, demonstrating the use of hashed JavaScript and CSS chunks. The example uses Rollup and the rollup-plugin-css-chunks for the build process. It also includes instructions for installation and usage, as well as information about passing props in the URL or via a POST request. Overall, this example showcases how to improve performance and initial loading speed with server-side rendering in Svelte 3.