Pyramid Just-In-Time Templating
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.
Currently, jQuery (v1.9.1+) is required for non-inline template delivery.
Project
Installation
$ pip install pyramid_jitt
Usage
Enable the package either in your INI file via:
pyramid.includes =
pyramid_beaker
pyramid_jitt
(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):
# ...
config.include('pyramid_beaker')
config.include('pyramid_jitt')
# ...
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:
<html>
<body>
${request.registry.jitt.render('webapp')|n}
<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!...
});
});
</script>
</body>
</html>
More Documentation
More documentation can be found in the Manual.
Metadata
Release files for pyramid_jitt 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pyramid_jitt-0.1.2.tar.gz | 15.4 kB | Without provenance | Details |
Release files / pyramid_jitt-0.1.2.tar.gz
| Download URL | pyramid_jitt-0.1.2.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fff4478285074b8824b7ae523b8814c0fa7d2d0782f186a9bcbcce3039faa215
|
|
BLAKE2b-256 checksum How to use checksums |
764a9bcd1cd9c4dc7be0fdaf6fb7847fcb5dc8521883b6263ec066c927bb97f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pyramid_jitt 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.