Skip to content

Commit a9e4954

Browse files
ModProgthedodd
authored andcommitted
Allow projects without rust
1 parent 7042e96 commit a9e4954

File tree

6 files changed

+40
-3
lines changed

6 files changed

+40
-3
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,5 @@ jobs:
181181
run: ${{ matrix.binPath }} --config=examples/yew/Trunk.toml build
182182
- name: Build | Examples | yew-tailwindcss
183183
run: ${{ matrix.binPath }} --config=examples/yew-tailwindcss/Trunk.toml build
184+
- name: Build | Examples | no-rust
185+
run: ${{ matrix.binPath }} --config=examples/no-rust/Trunk.toml build

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Subheadings to categorize changes are `added, changed, deprecated, removed, fixe
1818
- Additional attributes are now passed through script tags (fixes #429)
1919
- Updated internal http stack to axum v0.6.0.
2020
- Updated CLI argument parser to clap v0.4.
21+
- Reduce error to warning when processing a project without Cargo.toml and no `<link rel="rust"/>` (fixes #487)
2122

2223
### fixed
2324
- Nested WS proxies - if `backend=ws://localhost:8000/ws` is set, queries for `ws://localhost:8080/ws/entityX` will be linked with `ws://localhost:8000/ws/entityX`

examples/no-rust/Trunk.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build]
2+
target = "index.html"
3+
dist = "dist"

examples/no-rust/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8"/>
5+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
6+
<title>Trunk | No-Rust</title>
7+
8+
<link data-trunk rel="scss" href="index.scss"/>
9+
<base data-trunk-public-url/>
10+
</head>
11+
<body>
12+
<h1>Trunk without WASM</h1>
13+
</body>
14+
</html>

examples/no-rust/index.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@charset "utf-8";
2+
3+
html {
4+
body {
5+
font-size: 20pt;
6+
color: #111;
7+
font-family: sans-serif;
8+
9+
h1 {
10+
text-align: center;
11+
}
12+
}
13+
}

src/pipelines/html.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,17 @@ impl HtmlPipeline {
142142
r#"only one <link data-trunk rel="rust" data-type="main" .../> may be specified"#
143143
);
144144
if rust_app_nodes == 0 {
145-
let app = RustApp::new_default(
145+
if let Ok(app) = RustApp::new_default(
146146
self.cfg.clone(),
147147
self.target_html_dir.clone(),
148148
self.ignore_chan.clone(),
149149
)
150-
.await?;
151-
assets.push(TrunkAsset::RustApp(app));
150+
.await
151+
{
152+
assets.push(TrunkAsset::RustApp(app));
153+
} else {
154+
tracing::warn!("no rust project found")
155+
};
152156
}
153157

154158
// Spawn all asset pipelines.

0 commit comments

Comments
 (0)