npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ng-email/render

v0.1.0

Published

Render standalone Angular components to email-client-safe HTML and plain text on the server.

Readme

@ng-email/render

Render a standalone Angular component to email-client-safe HTML and plain text on the server. No browser is needed.

import { renderEmail, renderEmailBoth } from '@ng-email/render';
import { WelcomeEmail } from './emails/welcome.email';

const html = await renderEmail(WelcomeEmail, { inputs: { name: 'Ada' } });
const { html: body, text } = await renderEmailBoth(WelcomeEmail, { inputs: { name: 'Ada' } });

What it guarantees

  • inputs are type-checked against the component's signal inputs. Unknown names are rejected before rendering.
  • Async work (resource, pending tasks) is finished before the HTML is serialized.
  • Any error thrown while rendering rejects the promise. You never get partial HTML.
  • Angular artifacts are removed: ng-version, ng-server-context, _nghost/_ngcontent, ng-reflect-*, ngh, nge* selector attributes, and anchor comments. Component host elements whose tag contains a hyphen are unwrapped.
  • Outlook conditional comments (<!--[if mso]>…<![endif]-->) are kept.
  • A full document (output starting with <html>) gets the XHTML 1.0 Transitional doctype. Fragments get none.
  • Component styles / styleUrl raise EmailRenderError('COMPONENT_STYLES') instead of being silently lost.

Writing email components

  • Use encapsulation: ViewEncapsulation.None and no styles. Put styles inline.
  • <html>, <head> and <body> can sit directly in a component template.
  • Comments in templates are stripped by Angular. To emit an Outlook conditional, bind trusted HTML: [innerHTML]="sanitizer.bypassSecurityTrustHtml(constantString)". Never pass user data through the bypass.
  • Domino normalizes static style attributes (color:red becomes color: red;). Bind [attr.style] when the exact text matters.

Running outside the Angular CLI

Angular's npm packages ship partially compiled, so plain node cannot run them as published. Do one of the following:

  • Use @ng-email/cli (recommended). npx ng-email build src/emails/index.ts produces one self-contained bundle that any Node service can import. It re-exports renderEmail, so import the render functions from the bundle, not from this package. npx ng-email preview gives you a live browser preview.
  • Render from a server bundle built by the Angular CLI (@angular/build:application with SSR).
  • Bundle it yourself with the Angular Linker (@angular/compiler-cli/linker/babel). angularLinkerPlugin() from @ng-email/cli is a ready-made esbuild plugin for this.

API

| Export | | |---|---| | renderEmail(component, { inputs, providers, doctype }) | HTML string | | renderEmailText(component, { …, htmlToText }) | plain text | | renderEmailBoth(component, { … }) | { html, text } from one render | | toPlainText(html, options) / plainTextSelectors | html-to-text with email defaults | | cleanupEmailHtml(html) | string-level cleanup for HTML from elsewhere | | defineEmails({ name: defineEmail(Component, { previewInputs, description }) }) | typed registry read by ng-email preview and ng-email export. Names must be URL- and file-safe | | describeEmailComponent(component) / isEmailComponent(value) | selector and inputs of an email component / component check | | EmailRenderError (code) | NOT_A_COMPONENT, UNKNOWN_INPUT, COMPONENT_STYLES, SCRIPT_IN_OUTPUT, NO_OUTPUT |