angular-performance

Optimize Angular performance with NgOptimizedImage, @defer lazy loading, and SSR hydration.

2|Updated Jan 5, 2024
One-click install
npx skills add https://github.com/wilfriedago/dotfiles --skill angular-performance-wilfriedago
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: angular-performance
Source: https://github.com/wilfriedago/dotfiles/tree/main/agents/skills/angular-performance
Command: npx skills add https://github.com/wilfriedago/dotfiles --skill angular-performance-wilfriedago

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers optimize the performance of their Angular applications by implementing best practices for image loading, component rendering, and server-side rendering.

Core Features & Use Cases

  • Image Optimization: Utilize NgOptimizedImage for efficient image loading, including priority hints and fill modes.
  • Lazy Loading: Implement deferred loading for components and routes using @defer blocks and loadComponent/loadChildren.
  • SSR & Hydration: Configure Server-Side Rendering and client hydration for improved SEO and initial load times.
  • Use Case: Optimize a large e-commerce Angular application by ensuring all images are loaded efficiently and non-critical components are deferred until needed, leading to a faster user experience.

Quick Start

Apply the NgOptimizedImage directive to the hero image in your Angular component, ensuring width, height, and priority attributes are set.

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 Core Web Vitals?

Optimize images in Angular by applying the NgOptimizedImage directive to set priority hints and fill modes, which improves loading efficiency and boosts Core Web Vitals scores.

What is the best way to lazy load below-the-fold components in Angular?

The best way to lazy load below-the-fold components is using Angular @defer blocks, which delay component rendering until needed, reducing initial bundle sizes and accelerating page loads.

How does Server-Side Rendering and hydration affect SEO in Angular applications?

Server-Side Rendering and hydration improve Angular SEO by generating HTML on the server for faster initial page loads, ensuring search engines can crawl content efficiently.

Can I use loadComponent and loadChildren to reduce initial bundle sizes in large Angular apps?

Yes, you can use loadComponent and loadChildren to lazy load routes, splitting code to reduce initial bundle sizes and delivering faster load times for large Angular applications.

When should I use @defer blocks for lazy loading in an Angular e-commerce application?

Use @defer blocks in an Angular e-commerce application to defer non-critical components, ensuring efficient loading of below-the-fold content and priority assets for a faster experience.

Do I need to configure SSR and hydration to speed up initial page loads in Angular?

Yes, configuring SSR and hydration is required to speed up initial page loads, as it pre-renders content on the server to improve delivery times and SEO performance.