Rust library to generate static websites
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: dedicated examples directory

+81 -27
+9 -1
Cargo.lock
··· 1219 1219 ] 1220 1220 1221 1221 [[package]] 1222 - name = "maudit-example" 1222 + name = "maudit-example-basics" 1223 + version = "0.1.0" 1224 + dependencies = [ 1225 + "maud", 1226 + "maudit", 1227 + ] 1228 + 1229 + [[package]] 1230 + name = "maudit-example-kitchen-sink" 1223 1231 version = "0.1.0" 1224 1232 dependencies = [ 1225 1233 "maud",
+5 -1
Cargo.toml
··· 1 1 [workspace] 2 - members = ["crates/*"] 2 + members = ["crates/*", "examples/*"] 3 3 resolver = "2" 4 + 5 + [workspace.dependencies] 6 + maudit = { version = "0.1.0", path = "crates/framework" } 7 + maud = { version = "0.26.0" }
+1 -1
crates/framework/Cargo.toml
··· 6 6 edition = "2021" 7 7 8 8 [dependencies] 9 - maud = "0.26.0" 9 + maud = { workspace = true } 10 10 maudit-macros = { path = "../macros", version = "0.1" } 11 11 log = { version = "0.4", features = ["kv"] } 12 12 env_logger = "0.11.5"
-9
crates/user-example/Cargo.toml
··· 1 - [package] 2 - name = "maudit-example" 3 - version = "0.1.0" 4 - edition = "2021" 5 - publish = false 6 - 7 - [dependencies] 8 - maudit = { path = "../framework" } 9 - maud = "0.26.0"
crates/user-example/data/logo.svg examples/kitchen-sink/data/logo.svg
crates/user-example/data/script.js examples/kitchen-sink/data/script.js
crates/user-example/data/social-card.png examples/kitchen-sink/data/social-card.png
crates/user-example/data/some_other_script.js examples/kitchen-sink/data/some_other_script.js
crates/user-example/data/tailwind.css examples/kitchen-sink/data/tailwind.css
+1 -1
crates/user-example/src/main.rs examples/kitchen-sink/src/main.rs
··· 4 4 5 5 fn main() -> Result<BuildOutput, Box<dyn std::error::Error>> { 6 6 coronate( 7 - routes![Index, DynamicExample, Endpoint, HelloWorld], 7 + routes![Index, DynamicExample, Endpoint], 8 8 BuildOptions::default(), 9 9 ) 10 10 }
crates/user-example/src/pages/dynamic.rs examples/kitchen-sink/src/pages/dynamic.rs
crates/user-example/src/pages/endpoint.rs examples/kitchen-sink/src/pages/endpoint.rs
-14
crates/user-example/src/pages/hello_world.rs
··· 1 - use maud::html; 2 - use maudit::page::prelude::*; 3 - 4 - #[route("/hello-world")] 5 - pub struct HelloWorld; 6 - 7 - impl Page for HelloWorld { 8 - fn render(&self, _: &mut RouteContext) -> RenderResult { 9 - html! { 10 - h1 { "Hello World" } 11 - } 12 - .into() 13 - } 14 - }
crates/user-example/src/pages/index.rs examples/kitchen-sink/src/pages/index.rs
crates/user-example/tailwind.config.js examples/kitchen-sink/tailwind.config.js
+9
examples/basics/Cargo.toml
··· 1 + [package] 2 + name = "maudit-example-basics" 3 + version = "0.1.0" 4 + edition = "2021" 5 + publish = false 6 + 7 + [dependencies] 8 + maudit = { workspace = true } 9 + maud = { workspace = true }
+1
examples/basics/images/logo.svg
··· 1 + <svg xmlns="http://www.w3.org/2000/svg" width="357.3" height="281" fill="none"><path fill="#0d0d0d" d="M303 267c-51-6-51-6-83-5h-32l-63 7a1419 1419 0 0 0-92 12L22 173 12 66l-3-1C3 63-1 55 0 46c0-5 1-6 6-9 5-4 5-4 11-3 5 0 7 1 9 3 3 3 3 3 4 12 0 8 0 10-2 12l-2 2 15 19c22 27 58 67 59 66l4-15a1924 1924 0 0 1 13-64l-4-8c-3-3-7-11-9-16l-3-10 6-7c6-6 6-7 13-8 9-3 13-1 18 5 5 8 5 11 1 23l-4 12 7 21c7 19 7 19 27 52 20 32 25 39 26 36l3-14 14-60 10-48c0-2-2-3-5-6l-5-7 1-6c1-6 2-7 7-11 4-2 6-3 10-2 6 0 8 1 12 7 4 7 5 15 3 19l-6 5-5 3c0 5 48 117 49 117 4 0 5-5 18-63l13-59-6-4-5-3-1-10-1-10 6-8 6-8 8-1c8 0 8 0 13 3s6 4 7 11c2 8 2 15 0 18l-8 6-6 4 8 34 8 34 8 81c7 80 7 81 5 81z"/></svg>
+16
examples/basics/src/layout.rs
··· 1 + use maud::{html, Markup, DOCTYPE}; 2 + 3 + pub fn layout(content: Markup) -> Markup { 4 + html! { 5 + (DOCTYPE) 6 + html { 7 + head { 8 + meta charset="utf-8"; 9 + title { "Test page" } 10 + } 11 + body { 12 + (content) 13 + } 14 + } 15 + } 16 + }
+9
examples/basics/src/main.rs
··· 1 + mod layout; 2 + 3 + use maudit::{coronate, generate_pages_mod, routes, BuildOptions, BuildOutput}; 4 + 5 + generate_pages_mod!(); 6 + 7 + fn main() -> Result<BuildOutput, Box<dyn std::error::Error>> { 8 + coronate(routes![Index], BuildOptions::default()) 9 + }
+18
examples/basics/src/pages/index.rs
··· 1 + use crate::layout::layout; 2 + use maud::html; 3 + use maudit::page::prelude::*; 4 + 5 + #[route("/")] 6 + pub struct Index; 7 + 8 + impl Page for Index { 9 + fn render(&self, ctx: &mut RouteContext) -> RenderResult { 10 + let logo = ctx.assets.add_image("images/logo.svg"); 11 + 12 + layout(html! { 13 + (logo) 14 + h1 { "Hello World" } 15 + }) 16 + .into() 17 + } 18 + }
+9
examples/kitchen-sink/Cargo.toml
··· 1 + [package] 2 + name = "maudit-example-kitchen-sink" 3 + version = "0.1.0" 4 + edition = "2021" 5 + publish = false 6 + 7 + [dependencies] 8 + maudit = { workspace = true } 9 + maud = { workspace = true }
+3
examples/kitchen-sink/README.md
··· 1 + # kitchen-sink 2 + 3 + This directory contain a "kitchen sink" example that demonstrates the use of most of the features in Maudit. It is not necessarily a good starting point for a new project, but it can be useful for reference.