
Product
Introducing Historical Analytics – Now in Beta
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.
@jackdbd/fastify-webc
Advanced tools
Fastify plugin to render WebC templates and components.
npm install @jackdbd/fastify-webc
Register this plugin by telling it where to find your WebC components and templates.
This plugin decorates FastifyReply
with a render
method. This method takes two arguments: a WebC template and an optional data object.
import webc from '@jackdbd/fastify-webc'
fastify.register(webc, {
components: ['src/components/**/*.webc'],
templates: [path.join(__dirname, 'templates')]
})
fastify.get('/demo', function (request, reply) {
const data = { foo: 'bar' }
return reply.render('demo.webc', data)
})
To ensure TypeScript recognizes the render
method as part of the FastifyReply
object, you must use declaration merging to extend the FastifyReply
interface.
declare module 'fastify' {
interface FastifyReply {
render(template: string, data?: Record<string, any>): Promise<void>
}
}
You can access the WebC instance from your WebC template/component using this.webc
.
<code>this.webc</code>
<pre @text="JSON.stringify(this.webc, null, 2)"></pre>
You can access the data available to the WebC template/component using this.$data
.
<code>this.$data</code>
<pre @text="JSON.stringify(this.$data, null, 2)"></pre>
Package | Version |
---|---|
@11ty/webc | ^0.11.4 |
fastify-plugin | ^5.0.1 |
⚠️ Peer Dependencies
This package defines 1 peer dependency.
Peer | Version range |
---|---|
fastify | >=5.0.0 |
© 2024 - 2025 Giacomo Debidda // MIT License
FAQs
Fastify plugin to render WebC templates and components.
The npm package @jackdbd/fastify-webc receives a total of 1 weekly downloads. As such, @jackdbd/fastify-webc popularity was classified as not popular.
We found that @jackdbd/fastify-webc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.
Product
Module Reachability filters out unreachable CVEs so you can focus on vulnerabilities that actually matter to your application.
Company News
Socket is bringing best-in-class reachability analysis into the platform — cutting false positives, accelerating triage, and cementing our place as the leader in software supply chain security.