Nunjucks: Should I use precompilation for nodejs/express ?

Created on 27 Aug 2015  路  3Comments  路  Source: mozilla/nunjucks

Hi,

First of all, thanks for all the hard work, nunjucks is a great tool.

I have a question however, please forgive me if it sounds dumb, I couldn't find
a satisfying answer in the documentation / github issues.

Should I / can I use nunjucks precompilation for a production nodejs/express app ?
(I think this question is a good candidate for the FAQ btw)

If so, should I compile my templates on the app startup or in the build phase ?

How does this change the way I declare the use of nunjucks templates in my app?

Thanks,

Tim

Most helpful comment

There's not really a need to -- on the server, nunjucks will cache the compiled template the first time it's used by default.

The main usage for this is client-side templates, because it allows a slimmer nunjucks build to be sent down to the client and less work for the browser.

All 3 comments

There's not really a need to -- on the server, nunjucks will cache the compiled template the first time it's used by default.

The main usage for this is client-side templates, because it allows a slimmer nunjucks build to be sent down to the client and less work for the browser.

Makes sense, thank you.

@ziir @devoidfury Thank you for your q&a 馃槀

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kamlekar picture kamlekar  路  5Comments

Galfour picture Galfour  路  3Comments

felipenmoura picture felipenmoura  路  7Comments

wslx520 picture wslx520  路  4Comments

gaboesquivel picture gaboesquivel  路  4Comments