Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .vscode/settings.json

This file was deleted.

9 changes: 9 additions & 0 deletions Cargo.nightly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ wasm-bindgen = "0.2"
wasm-bindgen-test = "0.3"
web-sys = { version = "0.3", features = ["Document", "Window"] }

# [profile.dev]
# incremental = true
# opt-level = 0
# debug = 1 # Reduce debug info
# lto = false

# [profile.dev.package."*"]
# opt-level = 3 # optimize dependencies aggressively
# debug = 1 # we don’t need much debug info for dependencies

[profile.release]
opt-level = 'z'
Expand Down
9 changes: 9 additions & 0 deletions Cargo.stable.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ wasm-bindgen = "0.2"
wasm-bindgen-test = "0.3"
web-sys = { version = "0.3", features = ["Document", "Window"] }

# [profile.dev]
# incremental = true
# opt-level = 0
# debug = 1 # Reduce debug info
# lto = false

# [profile.dev.package."*"]
# opt-level = 3 # optimize dependencies aggressively
# debug = 1 # we don’t need much debug info for dependencies

[profile.release]
opt-level = 'z'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ cargo install cargo-generate trunk leptosfmt
To set up your project with this template, run

```sh
cargo generate --git https://github.com/leptos-community/start-trunk
cargo generate --git https://github.com/leptos-rs/start-trunk
```

to generate your new project, then
Expand Down
45 changes: 45 additions & 0 deletions Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# An example Trunk.toml with all possible fields along with their defaults.
# This file is taken from https://github.com/trunk-rs/trunk/blob/main/Trunk.toml

# A sem-ver version requirement of trunk required for this project
trunk-version = "*"

[build]
# The index HTML file to drive the bundling process.
target = "index.html"
Expand Down Expand Up @@ -25,6 +31,8 @@ inject_scripts = true
# no_sri = false
# An optional cargo profile to use
# cargo_profile = "release-trunk"
# Allow injecting a nonce attribute
# create_nonce = false

[watch]
# Paths to watch. The `build.target`'s parent folder is watched by default.
Expand Down Expand Up @@ -58,3 +66,40 @@ open = false
# tls_cert_path = "self_signed_certs/cert.pem"
# Additional headers to send. NOTE: header names must be valid HTTP headers.
# headers = { "X-Foo" = "bar" }

[clean]
# Optionally perform a cargo clean.
cargo = false

[tools]
# Default dart-sass version to download.
# sass = "1.69.5"
# Default wasm-bindgen version to download.
# wasm_bindgen = "0.2.89"
# Default wasm-opt version to download.
# wasm_opt = "version_123"
# Default tailwindcss-cli version to download.
# tailwindcss = "3.3.5"

## proxy
# Proxies are optional, and default to `None`.
# Proxies are only run as part of the `trunk serve` command.

# [[proxy]]
# This WebSocket proxy example has a backend and ws field. This example will listen for
# WebSocket connections at `/api/ws` and proxy them to `ws://localhost:9000/api/ws`.
# backend = "ws://localhost:9000/api/ws"
# ws = true


## hooks
# Hooks are optional, and default to `None`.
# Hooks are executed as part of Trunk's main build pipeline, no matter how it is run.

# [[hooks]]
# This hook example shows all the current available fields. It will execute the equivalent of
# typing "echo Hello Trunk!" right at the start of the build process (even before the HTML file
# is read). By default, the command is spawned directly and no shell is used.
# stage = "pre_build"
# command = "echo"
# command_arguments = ["Hello", "Trunk!"]
6 changes: 3 additions & 3 deletions cargo-generate.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ default_channel = { prompt = "Use stable or nightly channel?", choices = [
"stable",
"nightly",
], default = "stable", type = "string" }
vscode_settings = { prompt = "Generate default VS Code settings?", default = false, type = "bool" }
rust_analyzer_settings = { prompt = "Override `rustfmt` with `leptosfmt`?", default = false, type = "bool" }

[conditional.'vscode_settings == false']
ignore = [".vscode"]
[conditional.'rust_analyzer_settings == false']
ignore = ["rust-analyzer.toml"]

[hooks]
pre = ["switch_nightly_stable.rhai"]
2 changes: 2 additions & 0 deletions rust-analyzer.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[rustfmt]
overrideCommand = ["leptosfmt", "--stdin", "--rustfmt"]
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod components;
mod pages;

// Top-Level pages
use crate::pages::home::Home;
use crate::pages::{home::Home, not_found::NotFound};

/// An app router which renders the homepage and handles 404's
#[component]
Expand All @@ -26,7 +26,7 @@ pub fn App() -> impl IntoView {
<Meta name="viewport" content="width=device-width, initial-scale=1.0" />

<Router>
<Routes fallback=|| view! { NotFound }>
<Routes fallback=NotFound>
<Route path=path!("/") view=Home />
</Routes>
</Router>
Expand Down
5 changes: 4 additions & 1 deletion src/pages/not_found.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ use leptos::prelude::*;
/// 404 Not Found Page
#[component]
pub fn NotFound() -> impl IntoView {
view! { <h1>"Uh oh!" <br /> "We couldn't find that page!"</h1> }
view! {
<h1>"404: Page not found"</h1>
<h2>"We couldn't find that page!"</h2>
}
}