|
| 1 | +--- |
| 2 | +title : What is Panini Template Engine |
| 3 | +sidebar_label : What IS Panini |
| 4 | +--- |
| 5 | + |
| 6 | +# What is Panini Template Engine |
| 7 | + |
| 8 | +<SubHeading> Short introduction to Panini Template Engine</SubHeading> |
| 9 | + |
| 10 | +Panini is a lightweight, flexible, and easy-to-use templating engine for building static websites. It simplifies the process of creating and maintaining HTML templates for static web pages. |
| 11 | + |
| 12 | +> Here are some **key features and concepts related to Panini templates**: |
| 13 | +
|
| 14 | +## ✅ **Handlebars Templates** |
| 15 | + |
| 16 | +Panini uses the Handlebars templating language. Handlebars allows you to define dynamic templates with placeholders, called "partials" and "helpers," which are filled in with data during the build process. |
| 17 | + |
| 18 | +## ✅ **Partial Templates** |
| 19 | + |
| 20 | +Partials are reusable code snippets or templates that can be included in other templates. This encourages the creation of modular and DRY (Don't Repeat Yourself) code. |
| 21 | + |
| 22 | +## ✅ **Layouts** |
| 23 | + |
| 24 | +Panini allows you to define layout templates that wrap around the content of individual pages. This is useful for maintaining a consistent look and feel across your website. |
| 25 | + |
| 26 | +## ✅ **Data Files** |
| 27 | + |
| 28 | +You can use data files (typically in JSON or YAML format) to provide dynamic data to your templates. Data files are particularly useful for generating pages from structured content. |
| 29 | + |
| 30 | +## ✅ **Helpers** |
| 31 | + |
| 32 | +Handlebars helpers are custom functions that you can define to extend the capabilities of your templates. Panini provides some built-in helpers, and you can create your own as needed. |
| 33 | + |
| 34 | +## ✅ **Content Folders** |
| 35 | + |
| 36 | +Panini typically expects a specific folder structure for your project. Common folders include a "src" folder for source templates, a "dist" folder for the generated output, and additional folders for data and assets. |
| 37 | + |
| 38 | +## ✅ **Command-Line Interface (CLI)** |
| 39 | + |
| 40 | +Panini often comes with a command-line interface that simplifies tasks like generating the site, starting a development server, and watching for changes in your source files. |
| 41 | + |
| 42 | +# ✅ Example |
| 43 | + |
| 44 | +```html |
| 45 | +<!DOCTYPE html> |
| 46 | +<html> |
| 47 | +<head> |
| 48 | + <meta charset="UTF-8"> |
| 49 | + <title>{{title}}</title> |
| 50 | +</head> |
| 51 | +<body> |
| 52 | + <header> |
| 53 | + <h1>{{title}}</h1> |
| 54 | + </header> |
| 55 | + |
| 56 | + <main> |
| 57 | + {{> content}} |
| 58 | + </main> |
| 59 | + |
| 60 | + <footer> |
| 61 | + © {{year}} My Website |
| 62 | + </footer> |
| 63 | +</body> |
| 64 | +</html> |
| 65 | +``` |
| 66 | + |
| 67 | +In this example, the template uses placeholders like `{{title}}` and `{{year}}`, which can be filled in with data from data files or configuration. The `{{> content}}` syntax includes a partial template called "content." |
| 68 | + |
| 69 | +## ✅ In Summary |
| 70 | + |
| 71 | +Panini simplifies the process of building static websites by automating tasks like compiling templates, generating pages, and handling data. |
| 72 | +It is often used in combination with other build tools and static site generators to streamline web development workflows. |
| 73 | + |
| 74 | +## ✅ Resources |
| 75 | + |
| 76 | +- 👉 Access [AppSeed](https://appseed.us/) and start your next project |
| 77 | +- 👉 [Deploy Projects on Aws, Azure and Digital Ocean](https://www.docs.deploypro.dev/) via **DeployPRO** |
| 78 | +- 👉 Create an amazing landing page with [Simpllo, an open-source site builder](https://www.simpllo.com/) |
| 79 | +- 👉 [Django App Generator](https://app-generator.dev/django/) - A 2nd generation App Builder |
0 commit comments