===============================
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.
.. IMPORTANT::
As of 2016/10/09, "restricted" delivery (i.e. access-controlled
delivery control of all or a subset of the templates) is not yet
available.
Currently, `jQuery`_ (v1.9.1+) is required for non-inline template
delivery.
Project
=======
* Homepage: https://github.com/canaryhealth/pyramid_jitt
* Bugs: https://github.com/canaryhealth/pyramid_jitt/issues
Installation
============
.. code:: bash
$ pip install pyramid_jitt
Usage
=====
Enable the package either in your INI file via:
.. code:: ini
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:
.. code:: python
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:
.. code:: ini
# 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:
.. code:: mako
<html>
<body>
${request.registry.jitt.render('webapp')|n}
<script type="text/javascript">
$(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`_.
.. _jstc: https://pypi.python.org/pypi/jstc
.. _pyramid_beaker: https://pypi.python.org/pypi/pyramid_beaker
.. _Mako: http://www.makotemplates.org/
.. _jQuery: http://jquery.com/
.. TODO .. move the manual to pythonhosted.org...
.. _Manual: https://github.com/canaryhealth/pyramid_jitt/blob/master/pyramid_jitt/doc/manual.py
Raw data
{
"_id": null,
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"cheesecake_code_kwalitee_id": null,
"keywords": "web wsgi pyramid tween javascript compiler packager",
"author": "Philip J Grabner, Canary Health Inc",
"home_page": "http://github.com/canaryhealth/pyramid_jitt",
"github_user": "canaryhealth",
"download_url": "UNKNOWN",
"platform": "UNKNOWN",
"version": "0.1.2",
"cheesecake_documentation_id": null,
"description": "===============================\nPyramid Just-In-Time Templating\n===============================\n\nThe `pyramid_jitt` package is a wrapper around the `jstc`_ JavaScript\ntemplate compiler that allows client-side templates to be defined in\ndisparate server-side files and be assembled, pre-compiled, packaged,\ncached, and access-controlled for inline, deferred, and restricted\ndelivery.\n\n.. IMPORTANT::\n\n As of 2016/10/09, \"restricted\" delivery (i.e. access-controlled\n delivery control of all or a subset of the templates) is not yet\n available.\n\n\nCurrently, `jQuery`_ (v1.9.1+) is required for non-inline template\ndelivery.\n\n\nProject\n=======\n\n* Homepage: https://github.com/canaryhealth/pyramid_jitt\n* Bugs: https://github.com/canaryhealth/pyramid_jitt/issues\n\n\nInstallation\n============\n\n.. code:: bash\n\n $ pip install pyramid_jitt\n\n\nUsage\n=====\n\nEnable the package either in your INI file via:\n\n.. code:: ini\n\n pyramid.includes =\n pyramid_beaker\n pyramid_jitt\n\n\n(it is highly recommended to use `pyramid_beaker`_ for caching of\nrendered templates) or in code in your package's application\ninitialization via:\n\n.. code:: python\n\n def main(global_config, **settings):\n # ...\n config.include('pyramid_beaker')\n config.include('pyramid_jitt')\n # ...\n\n\nConfigure pyramid_jitt's behaviour by setting the various options in\nyour INI file (see the `Manual`_ for details), for example:\n\n.. code:: ini\n\n # use pyramid_beaker for caching!\n cache.type = memory\n cache.regions = pyramid_jitt\n cache.pyramid_jitt.expire = 3600\n\n # override all template attributes to disable deferred loading\n jitt.overrides.inline = true\n\n # define where the \"webapp\" templates (Handlebars, in this case) are\n # located and disable pre-compilation (only for \"webapp\" templates)\n jitt.@webapp.assets = myapp:static/scripts/**.hbs\n jitt.@webapp.overrides.precompile = false\n\n\nThen, add the delivery payload to your HTML file, here a `Mako`_\nexample:\n\n.. code:: mako\n\n <html>\n <body>\n\n ${request.registry.jitt.render('webapp')|n}\n\n <script type=\"text/javascript\">\n $(function() {\n $('#Templates').data('jitt').ready(function() {\n // start your client-side app that uses your templates here!...\n });\n });\n </script>\n </body>\n </html>\n\n\nMore Documentation\n==================\n\nMore documentation can be found in the `Manual`_.\n\n\n.. _jstc: https://pypi.python.org/pypi/jstc\n.. _pyramid_beaker: https://pypi.python.org/pypi/pyramid_beaker\n.. _Mako: http://www.makotemplates.org/\n.. _jQuery: http://jquery.com/\n\n.. TODO .. move the manual to pythonhosted.org...\n\n.. _Manual: https://github.com/canaryhealth/pyramid_jitt/blob/master/pyramid_jitt/doc/manual.py",
"lcname": "pyramid_jitt",
"name": "pyramid_jitt",
"github": true,
"bugtrack_url": null,
"license": "MIT (http://opensource.org/licenses/MIT)",
"travis_ci": false,
"github_project": "pyramid_jitt",
"summary": "A Just-In-Time compilation and packaging of JavaScript templates for Pyramid.",
"split_keywords": [
"web",
"wsgi",
"pyramid",
"tween",
"javascript",
"compiler",
"packager"
],
"author_email": "oss@canary.md",
"urls": [],
"cheesecake_installability_id": null,
"coveralls": true
}