muffin-jade

Jade templates for Muffin Framework


Keywords
asyncio, aiohttp, muffin, jade
License
MIT
Install
pip install muffin-jade==0.0.8

Documentation

Muffin-Jade

Muffin-Jade -- Jade template engine for Muffin framework.

Build Status http://img.shields.io/pypi/v/muffin-jade.svg?style=flat-square http://img.shields.io/pypi/dm/muffin-jade.svg?style=flat-square Donate

Requirements

  • python >= 3.3

Installation

Muffin-Jade should be installed using pip:

pip install muffin-jade

Usage

Add muffin_jade to PLUGINS in your Muffin Application configuration.

Options

JADE_CACHE_SIZE -- Cache size for compiled templates (100)

JADE_ENCODING -- Templates' encoding (UTF-8)

JADE_PRETTY -- Pretty output (True)

JADE_TEMPLATE_FOLDERS -- List of pathes to templates folder ([templates])

Views

# Register custom context provider
# could be a function/coroutine
@app.ps.jade.ctx_provider
def custom_context():
    return { 'VAR': 'VALUE' }

# Register a function into templates
@app.ps.jade.register
def sum(a, b):
    return a + b

@app.register('/')
def index(request):
    """ Check for user is admin. """
    local_context = {'key': 'value'}
    return app.ps.jade.render('index.jade', **local_context)

Bug tracker

If you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/klen/muffin-jade/issues

Contributing

Development of Muffin-Jade happens at: https://github.com/klen/muffin-jade

Contributors

  • klen (Kirill Klenov)

License

Licensed under a MIT license.