Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ara-framework/hypernova-jinja2-directive

Hypernova Directive for Jinja2.
https://github.com/ara-framework/hypernova-jinja2-directive

hypernova jinja2

Last synced: 4 days ago
JSON representation

Hypernova Directive for Jinja2.

Awesome Lists containing this project

README

        

# Hypernova Jinja2 Directive

> Hypernova Directive for Jinja2

This directive enables you render a Hypernova placeholder for [Nova Proxy](https://github.com/ara-framework/nova-proxy) using [Jinja2](https://github.com/pallets/jinja)

## Installation

You can install the package from pip.

```bash
pip install hypernova_jinja2_directive
```

## Setup

You need to register a global function when the Jinja2 environment is defined.
```python
from hypernova_jinja2_directive import nova

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

## Setup [Flask](https://github.com/pallets/flask).

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