djc / askama

Type-safe, compiled Jinja-like templates for Rust
Apache License 2.0
3.25k stars 213 forks source link

Conditional compiling - features #1076

Closed rtiagom closed 2 weeks ago

rtiagom commented 2 weeks ago

As seen in another issue, the following works:

{% if cfg!(debug_assertions) %}
    blah blah blah
{% endif %}

How to do the same for feature?

{% if cfg!(feature="web") %}
    blah blah blah
{% endif %}
rtiagom commented 2 weeks ago

My bad, I had a syntax error. It does work as expected.