
Security News
npm ‘is’ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
@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.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.