Skip to content

Commit d169f5c

Browse files
committed
feat: generate assets from extras
1 parent 9201ca8 commit d169f5c

12 files changed

+13
-33
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/target/
44

55
/dist/
6+
/gen_assets/
67
/src/extras/
78

89

build.rs

+10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ fn main() {
2121
}
2222
}
2323

24+
fs::copy("extras/comunidades/assets", "gen_assets").unwrap();
25+
2426
// Generate src/extras/mod.rs
2527
let mut out = fs::File::create("src/extras/mod.rs").unwrap();
2628
write!(out, "#[rustfmt::skip]\nmod comunities;\n#[rustfmt::skip]\nmod projects;\npub use comunities::*;\npub use projects::*;").unwrap();
@@ -116,6 +118,14 @@ fn generate_projects(path: PathBuf) {
116118
return;
117119
}
118120
let file_path = file.path();
121+
122+
if !file_path.extension().is_some_and(|e| e == "toml") {
123+
let file_name = file.file_name();
124+
let file_name = file_name.to_str().unwrap();
125+
// Copy images or other files
126+
fs::copy(&file_path, format!("gen_assets/{file_name}")).unwrap();
127+
}
128+
119129
let toml_str = fs::read_to_string(&file_path).unwrap();
120130
let toml_str = toml::from_str::<ProjectItem>(&toml_str).unwrap();
121131
projects.push((category.clone(), file_path, toml_str));

index.html

+2-33
Original file line numberDiff line numberDiff line change
@@ -67,36 +67,6 @@
6767
type="image/png"
6868
href="/public/rhq3ezvso9611-min.png"
6969
/>
70-
<link
71-
data-trunk
72-
rel="copy-file"
73-
type="image/png"
74-
href="/public/RustMX-min.png"
75-
/>
76-
<link
77-
data-trunk
78-
rel="copy-file"
79-
type="image/jpg"
80-
href="/public/RustGeneral.jpg"
81-
/>
82-
<link
83-
data-trunk
84-
rel="copy-file"
85-
type="image/jpg"
86-
href="/public/aprender-rust-min.jpg"
87-
/>
88-
<link
89-
data-trunk
90-
rel="copy-file"
91-
type="image/webp"
92-
href="/public/Whizzles.webp"
93-
/>
94-
<link
95-
data-trunk
96-
rel="copy-file"
97-
type="image/webp"
98-
href="/public/RustBCN.webp"
99-
/>
10070
<link
10171
data-trunk
10272
rel="copy-file"
@@ -105,9 +75,8 @@
10575
/>
10676
<link
10777
data-trunk
108-
rel="copy-file"
109-
type="image/png"
110-
href="/public/Salamandra.png"
78+
rel="copy-dir"
79+
href="/gen_assets/"
11180
/>
11281
<link rel="preconnect" href="https://fonts.googleapis.com" />
11382
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />

public/RustBCN.webp

-3.54 KB
Binary file not shown.

public/RustGeneral.jpg

-39.3 KB
Binary file not shown.

public/RustLogo-min.png

-60.2 KB
Binary file not shown.

public/RustMX-min.png

-11 KB
Binary file not shown.

public/RustMX.png

-33.5 KB
Binary file not shown.

public/Salamandra.png

-51.2 KB
Binary file not shown.

public/Whizzles.webp

-4.52 KB
Binary file not shown.

public/aprender-rust-min.jpg

-20.5 KB
Binary file not shown.

public/aprender-rust.jpg

-26.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)