mirror of
https://github.com/Xevion/time-banner.git
synced 2025-12-06 07:16:36 -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 {
|
pub fn new() -> Self {
|
||||||
let mut fontdb = fontdb::Database::new();
|
let mut fontdb = fontdb::Database::new();
|
||||||
fontdb.load_system_fonts();
|
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 }
|
Self { font_db: fontdb }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,15 @@ use timeago::Formatter;
|
|||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref TEMPLATES: Tera = {
|
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) => {
|
Ok(t) => {
|
||||||
let names: Vec<&str> = t.get_template_names().collect();
|
let names: Vec<&str> = t.get_template_names().collect();
|
||||||
println!("{} templates found ([{}]).", names.len(), names.join(", "));
|
println!("{} templates found ([{}]).", names.len(), names.join(", "));
|
||||||
|
|||||||
Reference in New Issue
Block a user