svelte-parser

Crates.iosvelte-parser
lib.rssvelte-parser
version0.1.3
sourcesrc
created_at2024-07-05 21:26:05.209303
updated_at2024-07-06 14:24:41.246447
descriptionCompile Svelte code into HTML, JS for expressrs
homepage
repository
max_upload_size
id1293411
size10,071
ContentGamer (ContentGamer)

documentation

README

Svelte Parser

a Svelte Parser for the expressrs crate.

Svelte Example

@.svelte (AKA the main route /)

<script lang="ts">
	const username: string = "Test";
	console.log(username);
</script>
<title>Custom page title (Fallback will be the file's name)</title>
<p>Hello world!</p>

How can i use this?

First you'll need to install the expressrs crate then in your code type this:


use expressrs::ExpressLib;
use svelte_parser::svelte;

fn main() {
	let express = ExpressLib::new();
	let app = express();

	app.plugins.push(svelte());
	// Serve a directory called 'public' that has .svelte files
	app.serve_directory(
        "public",
        Some(DirectoryOptions {
            plugin: "svelte".to_string(),
        }),
    );
}

Commit count: 0

cargo fmt