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

Configuration Options for dropwizard-views-mustache #1289

Closed
lefloh opened this Issue Oct 20, 2015 · 11 comments

Comments

Projects
None yet
5 participants
@lefloh
Contributor

lefloh commented Oct 20, 2015

The MustacheViewRenderer is caching templates forever so there's no chance for hot-deployment during development. Would it make sense to provide an option to disable caching during development or to define a cache-lifetime?

This should be no big change for the MustacheViewRenderer but as far as I've seen there's currently no way to pass any configuration to a ViewRenderer. ViewBundle#getViewConfiguration returns an empty Map. Am I missing something here?

@fexbraun

This comment has been minimized.

Contributor

fexbraun commented Oct 20, 2015

Hi,

Return of empty map was introduced to simplify usage of mustache views module:
"It's awkward to demand configuration from apps, even when they don't have any need to override the defaults."

"You can pass configuration through to view renderers by overriding getViewConfiguration:"
See: https://dropwizard.github.io/dropwizard/manual/views.html

And +1, I like the idea of enabling hot-deployment during development.

@lefloh

This comment has been minimized.

Contributor

lefloh commented Oct 20, 2015

How could I miss that? Thanks!

Seems like then it could easily be solved if MustacheViewRenderer would use CacheBuilder#expireAfterWrite?

@jplock

This comment has been minimized.

Member

jplock commented Jan 17, 2016

Is this still an issue? Do we need to clarify the documentation or is there a code change required to support this functionality?

@lefloh

This comment has been minimized.

Contributor

lefloh commented Jan 18, 2016

Yes there is a code change required. I would suggest to add a cache property to the view configuration:

views:
  .mustache:
    cache: false

The ViewRenderer implementations would need to bypass the LoadingCache in this case. Shall I provide a pull request?

lefloh added a commit to lefloh/dropwizard that referenced this issue Apr 17, 2016

@lefloh

This comment has been minimized.

Contributor

lefloh commented Apr 17, 2016

Tu sum up again: If you want to recompile mustache views during local development you should create a new MustacheFactory on each request. There's no big code change necessary. An example can be found here.

@acwwat

This comment has been minimized.

Contributor

acwwat commented Nov 9, 2016

Hello, any update on this issue? This feature would certainly help with faster local development. Even better, this can be combined with support for loading templates from the file system which I have implemented for my own project. Can open new issue and submit PR for it if appropriate.

@lefloh

This comment has been minimized.

Contributor

lefloh commented Nov 10, 2016

I already proposed a solution 7 month ago. It would be nice to get some feedback or otherwise just close this issue.

@arteam

This comment has been minimized.

Member

arteam commented Nov 10, 2016

Hi @lefloh,

Sorry it took so long to get back to you. Usually we try to keep turnaround time for new issues/proposals low while the reporter is still interested to contribute. I reviewed your code and it looks good to me. Could you submit a pull request, so we can polish the code, get feedback from @acwwat, and merge it to upstream. Thanks.

@lefloh

This comment has been minimized.

Contributor

lefloh commented Nov 10, 2016

Hi @arteam

Thanks for getting back. I opened PR 1814.
Don't get me wrong, I know there are much more important features on your list.

thanks
Flo

arteam added a commit that referenced this issue Nov 11, 2016

Merge pull request #1814 from lefloh/1289
#1289: Enabling configuration option for caching of Mustache Views
@arteam

This comment has been minimized.

Member

arteam commented Nov 11, 2016

Closed via #1814

arteam added a commit that referenced this issue Nov 11, 2016

@arteam arteam closed this Nov 11, 2016

@acwwat

This comment has been minimized.

Contributor

acwwat commented Nov 13, 2016

Thanks all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment