Posted on 23-02-2014
Filed Under (Technology) by bigbang

I am using Clojure & Compojure to write my webpages, and I am trying to use Selmer as template system for Clojure.

Here is my template file structure: there is a basic template file base.tpl which defines basic header, footer or something else. And some other files like index.tpl, search.tpl to do the real job by including base.tpl template. The base.tpl file defines the common part of my site and changes few times during my project lifetime.

In some suitations, we need to modify base.tpl. But after modification of base.tpl, Clojure & Selmer don’t re-render base.tpl when I visit and render index.tpl file. So I need to restart lein ring server every time after I modify base.tpl.

It is too troublesome and forgettable to restart lein ring server every time after modified base.tpl. Finally I find the reason on Selmer official doc site:

Note that changes in files referenced by the template will not trigger a recompile. This means that if your template extends or includes other templates you must touch the file that’s being rendered for changes to take effect.

Alternatively you can turn caching on and off using

(selmer.parser/cache-on!)

and

(selmer.parser/cache-off!)

respectively.

© 2014, The Big Bang on Reading Busy. All rights reserved.
On republishing this post you must provide link to the original post.

(0) Comments    (907) Views    Read More   
Post a Comment
Name:
Email:
Website:
Comments: