angular-performance

Implements NgOptimizedImage, @defer blocks, and SSR with client hydration in Angular applications.

2|Updated Aug 2, 2023
One-click install
npx skills add https://github.com/ic-facet/gestion-programas-asignatura --skill angular-performance-ic-facet
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: angular-performance
Source: https://github.com/ic-facet/gestion-programas-asignatura/tree/main/.cursor/skills/angular-performance
Command: npx skills add https://github.com/ic-facet/gestion-programas-asignatura --skill angular-performance-ic-facet

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses common performance bottlenecks in Angular applications, ensuring faster load times, smoother user experiences, and improved SEO.

Core Features & Use Cases

  • Image Optimization: Utilizes NgOptimizedImage for efficient image loading, including priority hints for LCP images and lazy loading.
  • Lazy Loading: Implements @defer blocks for on-demand loading of components and routes, reducing initial bundle size.
  • SSR & Hydration: Guides on choosing the right rendering strategy (SSR, CSR, SSG) and configuring client hydration.
  • Performance Best Practices: Offers solutions for slow computations, pure pipes, and memoization.

Quick Start

Optimize images in your Angular app by using the NgOptimizedImage directive with priority for LCP images.

Frequently Asked Questions about angular-performance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize images in Angular to improve page load speed?

Reduce Angular initial bundle size by implementing @defer blocks for on-demand component and route loading. This lazy loading strategy defers non-critical resources until they are needed, significantly speeding up initial load times.

What is the best way to configure server-side rendering in an Angular app?

Configure server-side rendering (SSR) with client hydration to generate HTML on the server and attach event listeners on the client. Choosing the right rendering strategy improves SEO and reduces time to interactive.

How do I fix slow computations affecting my Angular application performance?

Fix slow Angular computations by applying performance best practices like pure pipes and memoization. This prevents unnecessary recalculation during change detection cycles, smoothing out runtime user experiences.

Does NgOptimizedImage work with lazy loaded Angular components?

Yes, NgOptimizedImage works alongside lazy loaded components and routes managed by @defer blocks. Combining efficient image loading with deferred component rendering addresses multiple performance bottlenecks simultaneously.

When should I use client hydration instead of client-side rendering in Angular?

Use client hydration instead of client-side rendering (CSR) when implementing server-side rendering (SSR) to avoid app flickering. Hydration reuses server-rendered DOM, whereas CSR rebuilds it entirely from scratch.