Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/ara-framework/hypernova-jinja2-directive
- Owner: ara-framework
- License: mit
- Created: 2019-06-11T22:05:47.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-29T20:23:46.000Z (over 3 years ago)
- Last Synced: 2024-12-29T05:47:51.604Z (9 days ago)
- Topics: hypernova, jinja2
- Language: Python
- Homepage: https://pypi.org/project/hypernova-jinja2-directive/
- Size: 2.93 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 novaclass 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 novaapp.jinja_env.globals.update(nova=nova)
```
## UsageYou need to pass the component name and component data. The `data` is optional.
```
{{ nova('Navbar', {'brand':'Ara Framework'}) }}
```