Skip to main content

A Just-In-Time compilation and packaging of JavaScript templates for Pyramid.

Project description

The pyramid_jitt package is a wrapper around the jstc JavaScript template compiler that allows client-side templates to be defined in disparate server-side files and be assembled, pre-compiled, packaged, cached, and access-controlled for inline, deferred, and restricted delivery.


As of 2016/10/09, “restricted” delivery (i.e. access-controlled delivery control of all or a subset of the templates) and per-template JIT rendering is not yet available.

Currently, jQuery (v1.9.1+) is required for non-inline template delivery.


$ pip install pyramid_jitt


Enable the package either in your INI file via:

pyramid.includes =

(it is highly recommended to use pyramid_beaker for caching of rendered templates) or in code in your package’s application initialization via:

def main(global_config, **settings):
  # ...
  # ...

Configure pyramid_jitt’s behaviour by setting the various options in your INI file (see the Manual for details), for example:

# use pyramid_beaker for caching!
cache.type                        = memory
cache.regions                     = pyramid_jitt
cache.pyramid_jitt.expire         = 3600

# override all template attributes to disable deferred loading
jitt.overrides.inline             = true

# define where the "webapp" templates (Handlebars, in this case) are
# located and disable pre-compilation (only for "webapp" templates)
jitt.@webapp.assets               = myapp:static/scripts/**.hbs
jitt.@webapp.overrides.precompile = false

Then, add the delivery payload to your HTML file, here a Mako example:



    <script type="text/javascript">
      // NOTE: this must come **after** the `jitt.render` call!
      $(function() {
        $('#Templates').data('jitt').ready(function() {
          // start your client-side app that uses your templates here!...


More Documentation

More documentation can be found in the Manual.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyramid_jitt, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size pyramid_jitt-0.1.2.tar.gz (15.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page