2 releases
0.1.3 | Jul 6, 2024 |
---|---|
0.1.2 |
|
0.1.1 | Jul 5, 2024 |
0.1.0 |
|
#1749 in Web programming
10KB
251 lines
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(),
}),
);
}
Dependencies
~0.7–1.6MB
~35K SLoC