I am using nunjucks to template an interface in a python project. Nunjucks templates must be precompiled into production. I do not use extensions or asynchronous filters in nunjucks templates. Instead of using grunt-task to listen for changes in my templates, I prefer to use the nunjucks-precompile command (offered through npm) to expand the entire templates directory in templates.js.
The idea is for the nunjucks-precompile --include ["\\.tmpl$"] path/to/templates > templates.js executed in the setup.py file so that I can simply execute our deployment scripts regularly.
I found to override setuptools and the distutils script argument may serve the right purpose, but I'm not sure if this is the easiest approach to execute.
Another approach is to use subprocess to execute the command directly in setup.py, but I was warned about this (rather, proactive IMHO). I really don't understand why not.
Any ideas? Affirmations? Confirmations?
Update (04/2015):. If you do not have the nunjucks-precompile , simply use the Node package manager to install nunjucks as follows:
$ npm install nunjucks
source share