Lucàs 2f1f07c0bc Merge pull request #1 from LucasVbr/dev
feat: Add Github Action to publish package to NPM
2025-05-08 01:32:41 +02:00
2025-05-08 01:09:55 +02:00
2025-05-08 01:09:55 +02:00
2025-05-08 01:09:55 +02:00
2025-05-08 01:32:07 +02:00
2025-05-08 01:09:55 +02:00
2025-05-08 01:09:55 +02:00
2025-05-08 01:09:55 +02:00

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

@LucasVbr

License

MIT

S
Description
Pug renderer middleware for Hono
Readme MIT 60 KiB
Languages
TypeScript 100%