Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 953 Bytes

README.md

File metadata and controls

40 lines (27 loc) · 953 Bytes

Hypernova Jinja2 Directive

Hypernova Directive for Jinja2

This directive enables you render a Hypernova placeholder for Nova Proxy using Jinja2

Installation

You can install the package from pip.

pip install hypernova_jinja2_directive

Setup

You need to register a global function when the Jinja2 environment is defined.

from hypernova_jinja2_directive import nova

class JinjaEnvironment(Environment):
    def __init__(self,**kwargs):
        super(JinjaEnvironment, self).__init__(**kwargs)
        self.globals['nova'] = nova

Setup Flask.

from hypernova_jinja2_directive import nova

app.jinja_env.globals.update(nova=nova)

Usage

You need to pass the component name and component data. The data is optional.

{{ nova('Navbar', {'brand':'Ara Framework'}) }}