Eleventy Plugin Svelte screenshot

Eleventy Plugin Svelte

Author Avatar Theme by Gobeli
Updated: 17 Dec 2020
44 Stars

Eleventy plugin to support svelte templates

Categories

Overview

The Eleventy Plugin for Svelte is a plugin that enables the use of Svelte, a JavaScript framework for building user interfaces, with Eleventy, a static site generator. Inspired by eleventy-plugin-vue, this plugin allows developers to easily build and include *.svelte single file components in their Eleventy site. It also generates client-side JavaScript code that can be used to enable the hydration of static HTML.

Features

  • Builds *.svelte single file components.
  • Emits client-side JavaScript code for hydration of static HTML.
  • Allows data to be passed through Svelte props during runtime.
  • Supports customization with options.

Installation

To install the Eleventy Plugin for Svelte, run the following command:

npm install eleventy-plugin-svelte

Please note that this plugin requires experimental features in Eleventy, specifically the Custom File Extension Handlers feature. To enable experimental features, you can run Eleventy with the ELEVENTY_EXPERIMENTAL=true flag:

ELEVENTY_EXPERIMENTAL=true npx @11ty/eleventy

Summary

The Eleventy Plugin for Svelte is a useful tool for developers who want to incorporate Svelte into their Eleventy projects. With features such as building *.svelte components and generating client-side JavaScript code for hydration, this plugin simplifies the integration process. Its support for passing data through Svelte props during runtime allows for dynamic content customization. Installation is straightforward, requiring only a couple of commands. Overall, this plugin enhances the capabilities of Eleventy by integrating it with the powerful Svelte framework.