Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch template engine to Askama #6

Merged
merged 1 commit into from
Oct 29, 2019
Merged

Conversation

noirotm
Copy link
Contributor

@noirotm noirotm commented Oct 28, 2019

This commit has the benefit of improving type safety, as well as reducing code size.

It has been a bit challenging to use Askama, as the documentation isn't that great compared to handlebars, especially regarding custom filters.
For example, surprisingly, {{ a|b }} works, while {{ a | b }} refuses to compile.
It is also a little bit more rigid as templates need to be placed in a dedicated templates directory.

In the end it works fine 😄

@VictorKoenders
Copy link
Contributor

reducing code size.
🎉

as the documentation isn't that great compared to handlebars
This is something I also ran into when I began, but I personally don't see how to fix this

@VictorKoenders VictorKoenders merged commit e3ff474 into Trangar:master Oct 29, 2019
@VictorKoenders
Copy link
Contributor

I wish publish this to crates.io soon-ish, probably within 24 hours

@VictorKoenders
Copy link
Contributor

Released 0.2.0 🎉

Also apparently cargo doesn't like it when you modify the lib.rs during a deploy:

error: failed to verify package tarball

Caused by:
  Source directory was modified by build.rs during cargo publish. Build scripts should not modify anything outside of OUT_DIR.
Added: /home/trangar/development/rust/periodic_table/target/package/periodic_table-0.2.0/src/lib.rs

To proceed despite this, pass the `--no-verify` flag.

@VictorKoenders VictorKoenders mentioned this pull request Oct 29, 2019
4 tasks
@noirotm
Copy link
Contributor Author

noirotm commented Oct 29, 2019

cargo doesn't like it when you modify the lib.rs during a deploy

This could be fixed by following https://doc.rust-lang.org/cargo/reference/build-scripts.html#case-study-code-generation.

Basically, we keep a simple lib.rs which reexports a module written in OUT_DIR. Seems the cleanest thing to do.
I believe Askama itself writes the compiled template in that directory.

Gonna try this today.

@VictorKoenders
Copy link
Contributor

Yes, I think so too. I have opened an issue for this: #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants