Skip to content

Commit

Permalink
fix: do not open file before rendering template
Browse files Browse the repository at this point in the history
  • Loading branch information
InioX committed Dec 12, 2023
1 parent 1b6f265 commit 52dc36f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/util/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ impl Template {
));
}

data = engine.template(name)
.render(upon::value!{ colors: &colors, image: image, custom: &custom, })
.to_string()?;

let mut output_file = OpenOptions::new()
.create(true)
.truncate(true)
Expand All @@ -224,10 +228,6 @@ impl Template {
);
}

data = engine.template(name)
.render(upon::value!{ colors: &colors, image: image, custom: &custom, })
.to_string()?;

output_file.write_all(data.as_bytes())?;
success!(
"[{}/{}] Exported the <b><green>{}</> template to <d><u>{}</>",
Expand Down

0 comments on commit 52dc36f

Please sign in to comment.