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

https://github.com/jwdeveloper/temel

Html elements server side renderer
https://github.com/jwdeveloper/temel

html html-css-javascript html-python jinja jinja2 python-serverside-rendering renderer serverside-rendering templates

Last synced: 4 months ago
JSON representation

Html elements server side renderer

Awesome Lists containing this project

README

        







Temel

🚀 *Html elements server side renderer* ️🚀










# Introduction

Have you ever felt that `Jinja` templates are too harsh to work with, however
making frontend in `JavaScript` frameworks makes you 🤮? If so, you’ve come to the right place!


Temel is hybrid combines the flexibility of React-like components with the simplicity of Jinja templates.
It allows you to define elements as HTML files, and then use those elements as custom HTML tags named according to their respective file names.
[Check out an example to see how it works!](#define-templates)


Join the support [discord](https://discord.gg/2hu6fPPeF7) and visit the `#programming` channel for questions,
contributions and ideas. Feel free to make pull requests with missing/new features, fixes, etc

## Getting started

1. #### Install the dependencie

```xml
pip install temel
```


2. #### Define templates

`CustomButton.html`

```html


{{name}}

```

`Layout.html`

```html



Header section






```

`Page.html`

```html


Page Header Message


{{% for button in buttons %}}

{{% endfor %}}

```


3. Call the renderer. Let's render `Page.html`

```python

import temel

if __name__ == '__main__':
context = {
'buttons': [
{
'name': 'Home'
},
{
'name': 'Settings'
},
{
'name': 'Profile'
}]
}

temel.load_templates('C:\\templates')
output = temel.parse("Page.html", context)
with open('output.html', 'w') as f:
f.write(output)
```

4. See the output file

```html



Header section

Page Header Message





Home


Settings


Profile




```

## Contributing

[Library documentation for contributors](https://github.com/jwdeveloper/Temel)

Your improvements are welcome! Feel free to open an issue
or pull request.