mirror of
https://github.com/Xevion/time-banner.git
synced 2025-12-05 23:16:35 -06:00
feat: fix development build path patterns for templates/fonts
This commit is contained in:
@@ -24,7 +24,11 @@ impl Rasterizer {
|
||||
pub fn new() -> Self {
|
||||
let mut fontdb = fontdb::Database::new();
|
||||
fontdb.load_system_fonts();
|
||||
fontdb.load_fonts_dir("./fonts");
|
||||
fontdb.load_fonts_dir(if cfg!(debug_assertions) {
|
||||
"src/fonts"
|
||||
} else {
|
||||
"fonts"
|
||||
});
|
||||
|
||||
Self { font_db: fontdb }
|
||||
}
|
||||
|
||||
@@ -5,7 +5,15 @@ use timeago::Formatter;
|
||||
|
||||
lazy_static! {
|
||||
static ref TEMPLATES: Tera = {
|
||||
let mut _tera = match Tera::new("templates/**/*.svg") {
|
||||
let template_pattern = if cfg!(debug_assertions) {
|
||||
// Development: templates are in src/templates
|
||||
"src/templates/**/*.svg"
|
||||
} else {
|
||||
// Production: templates are in /usr/src/app/templates (relative to working dir)
|
||||
"templates/**/*.svg"
|
||||
};
|
||||
|
||||
let mut _tera = match Tera::new(template_pattern) {
|
||||
Ok(t) => {
|
||||
let names: Vec<&str> = t.get_template_names().collect();
|
||||
println!("{} templates found ([{}]).", names.len(), names.join(", "));
|
||||
|
||||
Reference in New Issue
Block a user