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

support runtime diet traits #33

Open
MartinNowak opened this issue Aug 9, 2017 · 2 comments
Open

support runtime diet traits #33

MartinNowak opened this issue Aug 9, 2017 · 2 comments

Comments

@MartinNowak
Copy link
Contributor

Right now usage of dietTraits requires either different template codepaths (if (dice) compile!TraitsA else compile!TraitsB) or global variables. This is a bit unfortunate since most mechanisms in the traits could work with a runtime value, e.g. htmlOutputStyle.
Would also be nice for stateful (cache) filters.

Might become a bit tricky with the different contexts (nested templates).

MartinNowak added a commit to MartinNowak/ddox that referenced this issue Aug 9, 2017
- allow to pretty-print HTML output (useful for tests and development)
- quite suboptimal due to rejectedsoftware/diet-ng#33
@s-ludwig
Copy link
Member

Actually, having htmlOutputStyle can have a considerable performance impact, because, instead of one large string with indentation and line endings, each bit of the output HTML would have to be output individually. Or, alternatively, every template would have to be rendered once for each possible setting.

@schveiguy
Copy link
Contributor

Using the system in #70, this might be more feasible. Because the strings to output are generated once (when a file is updated) and cached. Something like changing the HTML output style at runtime could re-generate the strings to output and then each subsequent page load could use the cache.

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

No branches or pull requests

3 participants