Need help with sauron?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

Global Rank
#57,635
Topics of expertise
wasm-bi...
databas...
org-mod...
databas...
vdom
gtk
elm
peg
Location
Philippines
1.2K Stars 25 Forks MIT License 923 Commits 7 Opened issues

Description

Sauron is an html web framework for building web-apps. It is heavily inspired by elm.

Services available

!
?

Need anything else?

Contributors list

Maintenance

sauron

Latest Version Build Status MIT licensed

sauron

Guide

Sauron is an web framework for creating fast and interactive client side web application, as well as server-side rendering for back-end web applications.

Example

use log::trace;
use sauron::html::attributes::attr;
use sauron::html::text;
use sauron::prelude::*;
use sauron::{Cmd, Component, Node, Program};

#[derive(Debug)] pub enum Msg { Click, }

pub struct App { click_count: u32, }

impl App { pub fn new() -> Self { App { click_count: 0 } } }

impl Component for App { fn view(&self) -> Node { node! {

"Minimal example"

{text(format!("Clicked: {}", self.click_count))}
} }

fn update(&amp;mut self, msg: Msg) -&gt; Cmd<self msg> {
    trace!("App is updating with msg: {:?}", msg);
    match msg {
        Msg::Click =&gt; self.click_count += 1,
    }
    Cmd::none()
}

}

#[wasm_bindgen(start)] pub fn main() { console_log::init_with_level(log::Level::Trace).unwrap(); console_error_panic_hook::set_once(); Program::mount_to_body(App::new()); }

index.html

html


<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<title>Minimal sauron app</title>


<script type="module">
    import init from './pkg/minimal.js';
    init().catch(console.error);
</script>

In Cargo.toml, specify the crate-type to be
cdylib

```toml

[package] name = "minimal" version = "0.1.0" edition = "2018"

[lib] crate-type = ["cdylib"]

[dependencies] sauron = "0.34" consoleerrorpanichook = "0.1" log = "0.4" consolelog = "0.2" ```

Build using

sh
$> wasm-pack build --target web --release
Look at the examples and the build script for the details.

Demo examples

  • todomvc The todomvc example
  • futuristic-ui - A demo of futuristic-ui showcasing animation, transition and timed Component update.
  • data-viewer - A resizable spreadsheet CSV data viewer
  • svg-clock - A clock drawn using SVG and window tick event.
  • svg-graph - A simple graph using SVG
  • ultron code-editor - A web-base text-editor with syntax highlighting

Converting HTML into Sauron's syntax

html2sauron - A tool to easily convert html into sauron node tree for your views.

Prerequisite:

cargo install wasm-pack
cargo install basic-http-server

Performance:

Sauron is one of the fastest.

Benchmark Benchmark

Run the benchmark yourself:

Benchmark 1 Benchmark 2

Please support this project:

Become a patron

License: MIT

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.