Skip to content

ara-framework/hypernova-jinja2-directive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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'}) }}