Genify is a Python script that allows you to render HTML templates using Jinja2. You can specify an input HTML file and a list of template files to include in the rendering process. The resulting HTML file will be saved in a "dist" directory.
- Clone the Genify repository to your local machine:
git clone https://github.com/your-username/genify.git
- Navigate to the Genify project directory:
cd genify
- Create and activate a virtual environment (recommended):
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
- Install the required dependencies using
pip
:
pip install -r requirements.txt
You can use Genify to render HTML templates by providing an input HTML file and one or more template files. Follow these steps to use Genify:
- Ensure you have Python 3.x installed on your system.
- Run Genify using the following command:
python genify.py -i input.html -t navbar.html -t footer.html ...
Replace input.html
with the path to your input HTML file and navbar.html
, footer.html
, etc., with the paths to your template files.
- The rendered HTML file will be saved in a "dist" directory within the Genify project folder.
Here's an example of how to use Genify with a base HTML file and separate templates for a navbar and a footer:
base.html
<!DOCTYPE html>
<html>
<head>
<title>Genify Example</title>
</head>
<body>
<!-- Include the navbar template -->
{% include 'navbar.html' %}
<main>
<h1>Hello, Genify!</h1>
<p>This is the main content of your page.</p>
</main>
<!-- Include the footer template -->
{% include 'footer.html' %}
</body>
</html>
navbar.html
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
footer.html
<footer>
<p>© 2023 Genify. All rights reserved.</p>
</footer>
Run Genify to render base.html
using navbar.html
and footer.html
:
python genify.py -i base.html -t navbar.html -t footer.html
This command will render base.html
with the provided navbar and footer templates and save the result in the "dist" directory.
Contributions to Genify are welcome! If you find any issues or have suggestions for improvements, please open an issue or create a pull request on the Genify GitHub repository.
Genify is open-source software licensed under the MIT License. See the LICENSE file for details.