-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bab4789
commit 93781a6
Showing
137 changed files
with
107 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use image::{DynamicImage, EncodableLayout, ImageReader}; | ||
use std::fs::File; | ||
use std::io::Write; | ||
use std::path::Path; | ||
use webp::{Encoder, WebPMemory}; | ||
|
||
pub fn image_to_webp(file_path_png: &Path, file_path_webp: &Path) -> Option<()> { | ||
let image = ImageReader::open(file_path_png).unwrap(); | ||
let image: DynamicImage = image.with_guessed_format().unwrap().decode().unwrap(); | ||
let encoder: Encoder = Encoder::from_image(&image).unwrap(); | ||
let encoded_webp: WebPMemory = encoder.encode(65f32); | ||
let mut webp_image = File::create(&file_path_webp).unwrap(); | ||
webp_image.write_all(encoded_webp.as_bytes()).unwrap(); | ||
Some(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { StaticServerRouter } from "./main.ts"; | ||
import { traverseFilesFlat } from "./utils/utils.ts"; | ||
import { Buffer } from "node:buffer"; | ||
|
||
export class StaticFiles { | ||
constructor( | ||
private staticServerRouter: StaticServerRouter, | ||
private buildPath: string, | ||
) {} | ||
async build() { | ||
try { | ||
await Deno.remove(this.buildPath, { recursive: true }); | ||
} catch { | ||
console.log("dist folder not found") | ||
} | ||
for (const route of this.staticServerRouter) { | ||
if (route.type === "static") { | ||
const files = await traverseFilesFlat(route.folder); | ||
for (const file of files) { | ||
if (route.condition(file)) { | ||
const folder = getFolderFromPath(file); | ||
const targetPosition = this.buildPath + file; | ||
console.log({ log: `creating: '${targetPosition}'` }); | ||
await Deno.mkdir(this.buildPath + folder, { recursive: true }); | ||
await Deno.copyFile(route.folder + file, targetPosition); | ||
} | ||
} | ||
} | ||
if (route.type === "generate") { | ||
const targetPathFileName = this.buildPath + route.relativeFileNamePath; | ||
console.log({ log: `creating: '${targetPathFileName}'` }); | ||
const data = new Uint8Array(Buffer.from(route.content())); | ||
await Deno.writeFile(targetPathFileName, data); | ||
} | ||
if (route.type === "html") { | ||
const fileName = route.relativeWebsitePath.endsWith(".html") | ||
? "" | ||
: "index.html"; | ||
const targetPathFileName = | ||
this.buildPath + route.relativeWebsitePath + fileName; | ||
const folder = getFolderFromPath(targetPathFileName); | ||
console.log({ log: `creating: '${targetPathFileName}'` }); | ||
await Deno.mkdir(folder, { recursive: true }); | ||
const data = new Uint8Array(Buffer.from(route.content())); | ||
await Deno.writeFile(targetPathFileName, data); | ||
} | ||
} | ||
} | ||
} | ||
|
||
function getFolderFromPath(file: string) { | ||
return file.split("/").slice(undefined, -1).join("/"); | ||
} |
Binary file modified
BIN
+15 KB
(100%)
...mblings_about_ecology_programming_languages_and_OOP_not_java/bands_family_tree.large.webp
Binary file not shown.
Binary file modified
BIN
+3.81 KB
(100%)
...blings_about_ecology_programming_languages_and_OOP_not_java/bands_family_tree.medium.webp
Binary file not shown.
Binary file modified
BIN
+2.31 KB
(100%)
...mblings_about_ecology_programming_languages_and_OOP_not_java/bands_family_tree.small.webp
Binary file not shown.
Binary file modified
BIN
+1012 Bytes
(100%)
...amblings_about_ecology_programming_languages_and_OOP_not_java/bands_family_tree.tiny.webp
Binary file not shown.
Binary file removed
BIN
-808 KB
...amblings_about_ecology_programming_languages_and_OOP_not_java/chamber.large.png
Binary file not shown.
Binary file added
BIN
+514 KB
...ophical_ramblings_about_ecology_programming_languages_and_OOP_not_java/chamber.large.webp
Binary file not shown.
Binary file removed
BIN
-214 KB
...mblings_about_ecology_programming_languages_and_OOP_not_java/chamber.medium.png
Binary file not shown.
Binary file added
BIN
+138 KB
...phical_ramblings_about_ecology_programming_languages_and_OOP_not_java/chamber.medium.webp
Binary file not shown.
Binary file removed
BIN
-152 KB
...amblings_about_ecology_programming_languages_and_OOP_not_java/chamber.small.png
Binary file not shown.
Binary file added
BIN
+96.1 KB
...ophical_ramblings_about_ecology_programming_languages_and_OOP_not_java/chamber.small.webp
Binary file not shown.
Binary file removed
BIN
-72.2 KB
...ramblings_about_ecology_programming_languages_and_OOP_not_java/chamber.tiny.png
Binary file not shown.
Binary file added
BIN
+44.6 KB
...sophical_ramblings_about_ecology_programming_languages_and_OOP_not_java/chamber.tiny.webp
Binary file not shown.
Binary file added
BIN
+90.8 KB
...philosophical_ramblings_about_ecology_programming_languages_and_OOP_not_java/chamber.webp
Binary file not shown.
Binary file removed
BIN
-923 KB
...ramming_languages_and_OOP_not_java/compexity_and_years_of_programming.large.png
Binary file not shown.
Binary file added
BIN
+472 KB
...logy_programming_languages_and_OOP_not_java/compexity_and_years_of_programming.large.webp
Binary file not shown.
Binary file removed
BIN
-62.9 KB
...amming_languages_and_OOP_not_java/compexity_and_years_of_programming.medium.png
Binary file not shown.
Binary file added
BIN
+40.5 KB
...ogy_programming_languages_and_OOP_not_java/compexity_and_years_of_programming.medium.webp
Binary file not shown.
Binary file removed
BIN
-44.9 KB
...ramming_languages_and_OOP_not_java/compexity_and_years_of_programming.small.png
Binary file not shown.
Binary file added
BIN
+29.2 KB
...logy_programming_languages_and_OOP_not_java/compexity_and_years_of_programming.small.webp
Binary file not shown.
Binary file removed
BIN
-22.7 KB
...gramming_languages_and_OOP_not_java/compexity_and_years_of_programming.tiny.png
Binary file not shown.
Binary file added
BIN
+14.9 KB
...ology_programming_languages_and_OOP_not_java/compexity_and_years_of_programming.tiny.webp
Binary file not shown.
Binary file added
BIN
+74.3 KB
...ut_ecology_programming_languages_and_OOP_not_java/compexity_and_years_of_programming.webp
Binary file not shown.
Binary file removed
BIN
-70.6 KB
...about_ecology_programming_languages_and_OOP_not_java/couplingcohesion.large.png
Binary file not shown.
Binary file added
BIN
+87.7 KB
...amblings_about_ecology_programming_languages_and_OOP_not_java/couplingcohesion.large.webp
Binary file not shown.
Binary file removed
BIN
-57.8 KB
...bout_ecology_programming_languages_and_OOP_not_java/couplingcohesion.medium.png
Binary file not shown.
Binary file added
BIN
+63.6 KB
...mblings_about_ecology_programming_languages_and_OOP_not_java/couplingcohesion.medium.webp
Binary file not shown.
Binary file removed
BIN
-43.8 KB
...about_ecology_programming_languages_and_OOP_not_java/couplingcohesion.small.png
Binary file not shown.
Binary file added
BIN
+44.3 KB
...amblings_about_ecology_programming_languages_and_OOP_not_java/couplingcohesion.small.webp
Binary file not shown.
Binary file removed
BIN
-23.7 KB
..._about_ecology_programming_languages_and_OOP_not_java/couplingcohesion.tiny.png
Binary file not shown.
Binary file added
BIN
+21.1 KB
...ramblings_about_ecology_programming_languages_and_OOP_not_java/couplingcohesion.tiny.webp
Binary file not shown.
Binary file added
BIN
+10.6 KB
...ical_ramblings_about_ecology_programming_languages_and_OOP_not_java/couplingcohesion.webp
Binary file not shown.
Binary file removed
BIN
-422 KB
...about_ecology_programming_languages_and_OOP_not_java/ecosystem_levels.large.jpg
Binary file not shown.
Binary file added
BIN
+1.66 MB
...amblings_about_ecology_programming_languages_and_OOP_not_java/ecosystem_levels.large.webp
Binary file not shown.
Binary file removed
BIN
-87.3 KB
...bout_ecology_programming_languages_and_OOP_not_java/ecosystem_levels.medium.jpg
Binary file not shown.
Binary file added
BIN
+388 KB
...mblings_about_ecology_programming_languages_and_OOP_not_java/ecosystem_levels.medium.webp
Binary file not shown.
Binary file removed
BIN
-61.2 KB
...about_ecology_programming_languages_and_OOP_not_java/ecosystem_levels.small.jpg
Binary file not shown.
Binary file added
BIN
+262 KB
...amblings_about_ecology_programming_languages_and_OOP_not_java/ecosystem_levels.small.webp
Binary file not shown.
Binary file removed
BIN
-28.6 KB
..._about_ecology_programming_languages_and_OOP_not_java/ecosystem_levels.tiny.jpg
Binary file not shown.
Binary file added
BIN
+115 KB
...ramblings_about_ecology_programming_languages_and_OOP_not_java/ecosystem_levels.tiny.webp
Binary file not shown.
Binary file added
BIN
+196 KB
...ical_ramblings_about_ecology_programming_languages_and_OOP_not_java/ecosystem_levels.webp
Binary file not shown.
Binary file removed
BIN
-258 KB
...languages_and_OOP_not_java/functional_design_patterns_scott_wlashchin.large.png
Binary file not shown.
Binary file added
BIN
+149 KB
...gramming_languages_and_OOP_not_java/functional_design_patterns_scott_wlashchin.large.webp
Binary file not shown.
Binary file removed
BIN
-188 KB
...anguages_and_OOP_not_java/functional_design_patterns_scott_wlashchin.medium.png
Binary file not shown.
Binary file added
BIN
+134 KB
...ramming_languages_and_OOP_not_java/functional_design_patterns_scott_wlashchin.medium.webp
Binary file not shown.
Binary file removed
BIN
-130 KB
...languages_and_OOP_not_java/functional_design_patterns_scott_wlashchin.small.png
Binary file not shown.
Binary file added
BIN
+94.1 KB
...gramming_languages_and_OOP_not_java/functional_design_patterns_scott_wlashchin.small.webp
Binary file not shown.
Binary file removed
BIN
-61.2 KB
..._languages_and_OOP_not_java/functional_design_patterns_scott_wlashchin.tiny.png
Binary file not shown.
Binary file added
BIN
+45.3 KB
...ogramming_languages_and_OOP_not_java/functional_design_patterns_scott_wlashchin.tiny.webp
Binary file not shown.
Binary file added
BIN
+22.8 KB
...gy_programming_languages_and_OOP_not_java/functional_design_patterns_scott_wlashchin.webp
Binary file not shown.
Binary file removed
BIN
-46 KB
...gy_programming_languages_and_OOP_not_java/johon_carmack_about_tooling.large.png
Binary file not shown.
Binary file added
BIN
+29.5 KB
...out_ecology_programming_languages_and_OOP_not_java/johon_carmack_about_tooling.large.webp
Binary file not shown.
Binary file removed
BIN
-54.4 KB
...y_programming_languages_and_OOP_not_java/johon_carmack_about_tooling.medium.png
Binary file not shown.
Binary file added
BIN
+26.8 KB
...ut_ecology_programming_languages_and_OOP_not_java/johon_carmack_about_tooling.medium.webp
Binary file not shown.
Binary file removed
BIN
-38.9 KB
...gy_programming_languages_and_OOP_not_java/johon_carmack_about_tooling.small.png
Binary file not shown.
Binary file added
BIN
+18.8 KB
...out_ecology_programming_languages_and_OOP_not_java/johon_carmack_about_tooling.small.webp
Binary file not shown.
Binary file removed
BIN
-19.6 KB
...ogy_programming_languages_and_OOP_not_java/johon_carmack_about_tooling.tiny.png
Binary file not shown.
Binary file added
BIN
+9.29 KB
...bout_ecology_programming_languages_and_OOP_not_java/johon_carmack_about_tooling.tiny.webp
Binary file not shown.
Binary file added
BIN
+9.11 KB
...ngs_about_ecology_programming_languages_and_OOP_not_java/johon_carmack_about_tooling.webp
Binary file not shown.
Binary file removed
BIN
-115 KB
...y_programming_languages_and_OOP_not_java/josevalim_about_polymorphism.large.png
Diff not rendered.
Binary file added
BIN
+51.3 KB
...ut_ecology_programming_languages_and_OOP_not_java/josevalim_about_polymorphism.large.webp
Binary file not shown.
Binary file removed
BIN
-102 KB
..._programming_languages_and_OOP_not_java/josevalim_about_polymorphism.medium.png
Diff not rendered.
Binary file added
BIN
+48.1 KB
...t_ecology_programming_languages_and_OOP_not_java/josevalim_about_polymorphism.medium.webp
Binary file not shown.
Binary file removed
BIN
-71.5 KB
...y_programming_languages_and_OOP_not_java/josevalim_about_polymorphism.small.png
Diff not rendered.
Binary file added
BIN
+33.8 KB
...ut_ecology_programming_languages_and_OOP_not_java/josevalim_about_polymorphism.small.webp
Binary file not shown.
Binary file removed
BIN
-36.3 KB
...gy_programming_languages_and_OOP_not_java/josevalim_about_polymorphism.tiny.png
Diff not rendered.
Binary file added
BIN
+16.6 KB
...out_ecology_programming_languages_and_OOP_not_java/josevalim_about_polymorphism.tiny.webp
Binary file not shown.
Binary file added
BIN
+15.9 KB
...gs_about_ecology_programming_languages_and_OOP_not_java/josevalim_about_polymorphism.webp
Binary file not shown.
Binary file removed
BIN
-667 KB
...ngs_about_ecology_programming_languages_and_OOP_not_java/langfamilyFP.large.png
Diff not rendered.
Binary file added
BIN
+438 KB
...al_ramblings_about_ecology_programming_languages_and_OOP_not_java/langfamilyFP.large.webp
Binary file not shown.
Binary file removed
BIN
-317 KB
...gs_about_ecology_programming_languages_and_OOP_not_java/langfamilyFP.medium.png
Diff not rendered.
Binary file added
BIN
+138 KB
...l_ramblings_about_ecology_programming_languages_and_OOP_not_java/langfamilyFP.medium.webp
Binary file not shown.
Binary file removed
BIN
-239 KB
...ngs_about_ecology_programming_languages_and_OOP_not_java/langfamilyFP.small.png
Diff not rendered.
Binary file added
BIN
+102 KB
...al_ramblings_about_ecology_programming_languages_and_OOP_not_java/langfamilyFP.small.webp
Binary file not shown.
Binary file removed
BIN
-128 KB
...ings_about_ecology_programming_languages_and_OOP_not_java/langfamilyFP.tiny.png
Diff not rendered.
Binary file added
BIN
+54.4 KB
...cal_ramblings_about_ecology_programming_languages_and_OOP_not_java/langfamilyFP.tiny.webp
Binary file not shown.
Binary file added
BIN
+123 KB
...sophical_ramblings_about_ecology_programming_languages_and_OOP_not_java/langfamilyFP.webp
Binary file not shown.
Binary file removed
BIN
-284 KB
...gs_about_ecology_programming_languages_and_OOP_not_java/langfamilyOOP.large.png
Diff not rendered.
Binary file added
BIN
+231 KB
...l_ramblings_about_ecology_programming_languages_and_OOP_not_java/langfamilyOOP.large.webp
Binary file not shown.
Binary file removed
BIN
-251 KB
...s_about_ecology_programming_languages_and_OOP_not_java/langfamilyOOP.medium.png
Diff not rendered.
Binary file added
BIN
+158 KB
..._ramblings_about_ecology_programming_languages_and_OOP_not_java/langfamilyOOP.medium.webp
Binary file not shown.
Binary file removed
BIN
-188 KB
...gs_about_ecology_programming_languages_and_OOP_not_java/langfamilyOOP.small.png
Diff not rendered.
Binary file added
BIN
+112 KB
...l_ramblings_about_ecology_programming_languages_and_OOP_not_java/langfamilyOOP.small.webp
Binary file not shown.
Binary file removed
BIN
-100 KB
...ngs_about_ecology_programming_languages_and_OOP_not_java/langfamilyOOP.tiny.png
Diff not rendered.
Binary file added
BIN
+55.8 KB
...al_ramblings_about_ecology_programming_languages_and_OOP_not_java/langfamilyOOP.tiny.webp
Binary file not shown.
Binary file added
BIN
+56.3 KB
...ophical_ramblings_about_ecology_programming_languages_and_OOP_not_java/langfamilyOOP.webp
Binary file not shown.
Binary file removed
BIN
-54.4 KB
...s_about_ecology_programming_languages_and_OOP_not_java/languages_logo.large.png
Diff not rendered.
Binary file added
BIN
+72.1 KB
..._ramblings_about_ecology_programming_languages_and_OOP_not_java/languages_logo.large.webp
Binary file not shown.
Binary file removed
BIN
-38.5 KB
..._about_ecology_programming_languages_and_OOP_not_java/languages_logo.medium.png
Diff not rendered.
Binary file added
BIN
+45.6 KB
...ramblings_about_ecology_programming_languages_and_OOP_not_java/languages_logo.medium.webp
Binary file not shown.
Binary file removed
BIN
-29.3 KB
...s_about_ecology_programming_languages_and_OOP_not_java/languages_logo.small.png
Diff not rendered.
Binary file added
BIN
+32.8 KB
..._ramblings_about_ecology_programming_languages_and_OOP_not_java/languages_logo.small.webp
Binary file not shown.
Binary file removed
BIN
-15.8 KB
...gs_about_ecology_programming_languages_and_OOP_not_java/languages_logo.tiny.png
Diff not rendered.
Binary file added
BIN
+15.7 KB
...l_ramblings_about_ecology_programming_languages_and_OOP_not_java/languages_logo.tiny.webp
Binary file not shown.
Binary file added
BIN
+15.7 KB
...phical_ramblings_about_ecology_programming_languages_and_OOP_not_java/languages_logo.webp
Binary file not shown.
Binary file modified
BIN
+2.55 KB
(100%)
...lings_about_ecology_programming_languages_and_OOP_not_java/natural_lang_family.large.webp
Binary file not shown.
Binary file modified
BIN
+1.34 KB
(100%)
...ings_about_ecology_programming_languages_and_OOP_not_java/natural_lang_family.medium.webp
Binary file not shown.
Binary file modified
BIN
+832 Bytes
(100%)
...lings_about_ecology_programming_languages_and_OOP_not_java/natural_lang_family.small.webp
Binary file not shown.
Binary file modified
BIN
+252 Bytes
(100%)
...blings_about_ecology_programming_languages_and_OOP_not_java/natural_lang_family.tiny.webp
Binary file not shown.
Binary file removed
BIN
-266 KB
...bout_ecology_programming_languages_and_OOP_not_java/objects_good_part.small.png
Diff not rendered.
Binary file added
BIN
+193 KB
...mblings_about_ecology_programming_languages_and_OOP_not_java/objects_good_part.small.webp
Binary file not shown.
Binary file removed
BIN
-109 KB
...about_ecology_programming_languages_and_OOP_not_java/objects_good_part.tiny.png
Diff not rendered.
Binary file added
BIN
+84 KB
...amblings_about_ecology_programming_languages_and_OOP_not_java/objects_good_part.tiny.webp
Binary file not shown.
Binary file added
BIN
+19.4 KB
...cal_ramblings_about_ecology_programming_languages_and_OOP_not_java/objects_good_part.webp
Binary file not shown.
Binary file removed
BIN
-284 KB
...ngs_about_ecology_programming_languages_and_OOP_not_java/oopinfluence.large.png
Diff not rendered.
Binary file added
BIN
+231 KB
...al_ramblings_about_ecology_programming_languages_and_OOP_not_java/oopinfluence.large.webp
Binary file not shown.
Binary file removed
BIN
-251 KB
...gs_about_ecology_programming_languages_and_OOP_not_java/oopinfluence.medium.png
Diff not rendered.
Binary file added
BIN
+158 KB
...l_ramblings_about_ecology_programming_languages_and_OOP_not_java/oopinfluence.medium.webp
Binary file not shown.
Binary file removed
BIN
-188 KB
...ngs_about_ecology_programming_languages_and_OOP_not_java/oopinfluence.small.png
Diff not rendered.
Binary file added
BIN
+112 KB
...al_ramblings_about_ecology_programming_languages_and_OOP_not_java/oopinfluence.small.webp
Binary file not shown.
Binary file removed
BIN
-100 KB
...ings_about_ecology_programming_languages_and_OOP_not_java/oopinfluence.tiny.png
Diff not rendered.
Binary file added
BIN
+55.8 KB
...cal_ramblings_about_ecology_programming_languages_and_OOP_not_java/oopinfluence.tiny.webp
Binary file not shown.
Binary file added
BIN
+56.3 KB
...sophical_ramblings_about_ecology_programming_languages_and_OOP_not_java/oopinfluence.webp
Binary file not shown.
Binary file removed
BIN
-948 KB
...about_ecology_programming_languages_and_OOP_not_java/toomanyspiderman.large.png
Diff not rendered.
Binary file added
BIN
+697 KB
...amblings_about_ecology_programming_languages_and_OOP_not_java/toomanyspiderman.large.webp
Binary file not shown.
Binary file removed
BIN
-349 KB
...bout_ecology_programming_languages_and_OOP_not_java/toomanyspiderman.medium.png
Diff not rendered.
Binary file added
BIN
+289 KB
...mblings_about_ecology_programming_languages_and_OOP_not_java/toomanyspiderman.medium.webp
Binary file not shown.
Binary file removed
BIN
-240 KB
...about_ecology_programming_languages_and_OOP_not_java/toomanyspiderman.small.png
Diff not rendered.
Binary file added
BIN
+196 KB
...amblings_about_ecology_programming_languages_and_OOP_not_java/toomanyspiderman.small.webp
Binary file not shown.
Binary file removed
BIN
-108 KB
..._about_ecology_programming_languages_and_OOP_not_java/toomanyspiderman.tiny.png
Diff not rendered.
Binary file added
BIN
+85.3 KB
...ramblings_about_ecology_programming_languages_and_OOP_not_java/toomanyspiderman.tiny.webp
Binary file not shown.
Binary file added
BIN
+72.1 KB
...ical_ramblings_about_ecology_programming_languages_and_OOP_not_java/toomanyspiderman.webp
Binary file not shown.