Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fresh/src/server/types.ts>Plugin

The next-gen web framework.
Extremely Popular
Go to Latest
interface Plugin
import { type Plugin } from "https://deno.land/x/fresh@1.1.2/src/server/types.ts";

Properties

name: string

The name of the plugin. Must be snake-case.

optional
entrypoints: Record<string, string>

A map of a snake-case names to a import specifiers. The entrypoints declared here can later be used in the "scripts" option of PluginRenderResult to load the entrypoint's code on the client.

Methods

optional
render(ctx: PluginRenderContext): PluginRenderResult

The render hook is called on the server every time some JSX needs to be turned into HTML. The render hook needs to call the ctx.render function exactly once.

The hook can return a PluginRenderResult object that can do things like inject CSS into the page, or load additional JS files on the client.