mirror of
https://github.com/LucasVbr/hono-pug-renderer.git
synced 2026-05-13 17:21:51 +00:00
1.0 KiB
1.0 KiB
Pug Renderer Middleware for Hono
Description
This is a middleware for the Hono framework that allows you to render Pug templates. It provides a simple way to integrate Pug rendering into your Hono applications.
Installation
To install the middleware, you can use npm or yarn:
npm install hono-pug-renderer
or
yarn add hono-pug-renderer
or
pnpm add hono-pug-renderer
or
bun add hono-pug-renderer
Usage
Basic Example
import {Hono} from 'hono';
import {pugRenderer} from 'hono-pug-renderer';
import path from 'path';
const app = new Hono();
app.use('*', pugRenderer(path.join(__dirname, 'views')));
app.get('/', (c) => {
return c.pug('index');
});
export default app;
Options
You can pass options to the pugRenderer function to customize its behavior.
app.get('/', (c) => {
return c.pug('index', {
title: 'My Page',
message: 'Hello, world!'
});
});
Author
License
MIT