Skip to content

Commit c7ef552

Browse files
committed
Version 0.2.0
- Fix wasm-opt failure from debug symbols - Fix 404 on /favicon.ico - Don't add hash to asset names - Update deps
1 parent 8668e2a commit c7ef552

File tree

8 files changed

+37
-24
lines changed

8 files changed

+37
-24
lines changed

.cargo/config.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[build]
22
target = "wasm32-unknown-unknown"
3+
rustflags = ["-Cdebuginfo=0", "-Cstrip=symbols"]
34

45
[profile.release]
56
opt-level = "z"
67
debug = false
7-
lto = true
8+
lto = "fat"
89
codegen-units = 1
910
panic = "abort"
1011
strip = true

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
[package]
22
name = "kratos-selfservice-rust"
3-
version = "0.1.1"
3+
version = "0.2.0"
44
authors = ["JES <justin@jes.contact>"]
55
edition = "2024"
66

7+
[package.metadata.wasm-pack.profile.release]
8+
wasm-opt = ["--enable-bulk-memory"]
9+
710
[dependencies]
811
dioxus = { version = "0.7", features = ["router"] }
912
chrono = { version = "0.4", default-features = false, features = [

Dioxus.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ out_dir = "dist"
77
copyright = "Justin's Engineering Services, LLC"
88
identifier = "com.justinsengineering"
99
publisher = "Justin's Engineering Services, LLC"
10+
icon = ["assets/favicon.ico"]
1011

1112
[web.app]
12-
1313
# HTML title tag content
1414
title = "Kratos"
1515

Dockerfile

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,34 @@ RUN set -ex \
1010
&& cargo binstall dioxus-cli
1111

1212
COPY --link Cargo.lock Cargo.toml Dioxus.toml package.json bun.lock tailwind.css ./
13-
COPY --link ./assets/* ./assets/
14-
COPY --link ./.cargo/* ./.cargo/
15-
COPY --link ./src/main.rs ./src/
16-
COPY --link ./src/components ./src/components/
17-
COPY --link ./src/views ./src/views/
13+
COPY --link ./assets ./assets
14+
COPY --link ./.cargo ./.cargo
15+
COPY --link ./src ./src
1816

17+
# Install bun
1918
RUN set -ex \
2019
&& curl -fsSL https://bun.com/install | bash \
2120
&& mv ~/.bun/bin/bun /usr/bin/
2221

22+
# Install js deps and process tailwind.css
2323
RUN set -ex \
2424
&& printenv \
2525
&& bun install --production \
2626
&& bun x @tailwindcss/cli -i ./tailwind.css -o ./assets/tailwind.css --minify
2727

28+
# Add wasm32 rust target and caro install
2829
RUN set -ex \
2930
&& rustup target add wasm32-unknown-unknown \
3031
&& cargo install --path .
3132

33+
# Dioxus bundle/build
34+
RUN set -ex && dx bundle --web --release
35+
36+
# Add httpd rules
3237
RUN set -ex \
33-
&& dx bundle --web --release \
34-
&& echo "E404:index.html\n.wasm:application/wasm" > httpd.conf
38+
&& echo "E404:index.html" > httpd.conf \
39+
&& echo ".wasm:application/wasm" >> httpd.conf \
40+
&& echo "P:/favicon.ico:127.0.0.1:4455/assets/favicon.ico" >> httpd.conf
3541

3642
FROM lipanski/docker-static-website:latest
3743
COPY --from=build /usr/src/app/httpd.conf /etc/httpd.conf

bun.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"dependencies": {
3-
"daisyui": "^5.5.14",
3+
"daisyui": "^5.5.16",
44
"tailwindcss": "^4.1.18"
55
},
66
"devDependencies": {

src/main.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ enum Route {
7474
PageNotFound { route: Vec<String> },
7575
}
7676

77-
const FAVICON: Asset = asset!("/assets/favicon.ico");
78-
const TAILWIND_CSS: Asset = asset!("/assets/tailwind.css");
79-
8077
fn main() {
8178
dioxus::logger::initialize_default();
8279
dioxus::launch(App);
@@ -92,8 +89,14 @@ fn App() -> Element {
9289
(set_state)();
9390

9491
rsx! {
95-
document::Link { rel: "icon", href: FAVICON }
96-
document::Link { rel: "stylesheet", href: TAILWIND_CSS }
92+
document::Link {
93+
rel: "icon",
94+
href: asset!("/assets/favicon.ico", AssetOptions::builder().with_hash_suffix(false)),
95+
}
96+
document::Link {
97+
rel: "stylesheet",
98+
href: asset!("/assets/tailwind.css", AssetOptions::builder().with_hash_suffix(false)),
99+
}
97100
Router::<Route> {}
98101
}
99102
}

0 commit comments

Comments
 (0)